Getting the following error when running my application.
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
On form load it reads the database to the textboxes for the user, they can then change their details.
On clicking the save button I am attempting to update the database with the information from a textbox but the above error is thrown and I'm not a bit lost.
Here is my code
Any help would be great Thanks
Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.
On form load it reads the database to the textboxes for the user, they can then change their details.
On clicking the save button I am attempting to update the database with the information from a textbox but the above error is thrown and I'm not a bit lost.
Here is my code
Code:
Private Sub WriteRecords()
'Database Connection for save
Dim Con As New OleDb.OleDbConnection
Dim ds As New DataSet
Dim da As OleDb.OleDbDataAdapter
Dim sqlcode As String
Con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=D:\test.mdb; User ID=Admin; Password= ;"
Con.Open()
sqlcode = "SELECT * FROM [User]"
da = New OleDb.OleDbDataAdapter(sqlcode, Con)
da.Fill(ds, "RefUser")
Con.Close()
'Update dataset with user info
ds.Tables("RefUser").Rows(0).Item(1) = tb_fname.Text
'Update data
Dim cb As New OleDb.OleDbCommandBuilder(da)
da.Update(ds, "RefUser")
'Close the form
Closeform()
End Sub
Comment