L
Lora Connors
I have written the following code to insert records into
Access database. If I use the DataAdapter.Fill method in
the Add Command button as shown below I get the
message "Unhandled OleDbException occurred in
System.Data.dll". Ditto if I use the Fill method in the
Event procedure MyBase.load.
'GENERAL DECLARATIONS
Dim daAddMovie As New OleDbDataAdapter _
("select MovieId,MovieTitle,Cast,No_of_Copies,Rating
from movies", strConnection)
Dim tblAddMovie As New DataTable("Movies")
'SUB TO ADD RECORD TO DATATABLE
PUBLIC SUB ADD(ByVal sender As Object, ByVal e As
System.EventArgs) handles cmdAdd.Click
daAddMovie.Fill(tblAddMovie) 'Fill the Datatable
Dim Insertvalues As Object() = {Autonumber,
txtMovieTitle.Text, txtCast.Text, CInt(cmbCopies.Text),
bolRating}
tblAddMovie.LoadDataRow(Insertvalues, False)
Access database. If I use the DataAdapter.Fill method in
the Add Command button as shown below I get the
message "Unhandled OleDbException occurred in
System.Data.dll". Ditto if I use the Fill method in the
Event procedure MyBase.load.
'GENERAL DECLARATIONS
Dim daAddMovie As New OleDbDataAdapter _
("select MovieId,MovieTitle,Cast,No_of_Copies,Rating
from movies", strConnection)
Dim tblAddMovie As New DataTable("Movies")
'SUB TO ADD RECORD TO DATATABLE
PUBLIC SUB ADD(ByVal sender As Object, ByVal e As
System.EventArgs) handles cmdAdd.Click
daAddMovie.Fill(tblAddMovie) 'Fill the Datatable
Dim Insertvalues As Object() = {Autonumber,
txtMovieTitle.Text, txtCast.Text, CInt(cmbCopies.Text),
bolRating}
tblAddMovie.LoadDataRow(Insertvalues, False)