VB.NET2005 save data from grid?

hi dears .........

only problem with cmdSave_click

when i make changes to grid data and click to update then an error messege appears "Update requires a valid UpdateCommand when passed DataRow collection with modified rows." i also tried with command builder but invain. review my code if there is any error........

Dim Con As OleDb.OleDbConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:Test.mdb")
dim Dset As New DataSet
dim db As OleDb.OleDbDataAdapter

Private Sub cmdLoad_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click

db = New OleDb.OleDbDataAdapter("select * from stu", Con)
table = Dset.Tables("stu")
db.Fill(Dset, "stu")
DataGridView1.DataSource = Dset.Tables("stu")
End Sub

'Here is problem
Private Sub cmdSave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click

db.Update(Dset, "stu") 'error messege appears
End Sub
Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!