Hi everyone,
I'm doing a form created from Visual Studio 2005 which contain a "Add" button and a DataGridView. If the records are successfully added, it will be inserted into the SQL server database.
I am trying to insert records from DataGridView into my SQL Server database without retrieving any information and I do not require to retrieve records from database. Initally, the database in SQL Server is empty. For this program, I made use of the SqlDataAdapter, DataSet and BindingSource.
This is my latest codings as listed below:
Dim sqlcom As SqlCommand = New SqlCommand()
Dim da As New SqlDataAdapter("SELECT * FROM TBReqDG", sqlcon)
Dim myDataSet As New DataSet()
Dim cb As New SqlCommandBuilder(da)
da.InsertCommand = cb.GetInsertCommand()
da.Update(myDataSet, "TBReqDG") 'ERROR COMES FROM HERE
'Open connection, execute the commands
sqlcon.Open()
sqlcom.Connection = sqlcon
'Close Connection
sqlcon.Close()
As my program runs, it show this error:
Update unable to find TableMapping['TBReqDG'] or DataTable 'TBReqDG'.
I don't know where it had gone wrong and hope anyone who knows is able to guide me along.
Hope to receive reply soon as itâs urgent & thanks. =):D
Regards
Tracy
|