i have the fellowing code for updating the database when its change in data grid
While (r < DataGridView1.Rows.Count - 1) InsertCommand1.Parameters.Clear() InsertCommand1.CommandText = "UPDATE [Section] SET Capacity =" & DataGridView1.Rows(r).Cells(2).Value & " WHERE SectionID = " & DataGridView1.Rows(r).Cells(1).Value InsertCommand1.CommandType = CommandType.Text InsertCommand1 = InsertCommand1 DataAdapter1.InsertCommand = InsertCommand1 InsertCommand1.ExecuteNonQuery() DataAdapter1.Update(DataSet1, "Section") r += 1 End While
it make the update but it give the fellowing error
Update requires a valid UpdateCommand when passed DataRow collection with modified rows.
when i but the fellowing command
Dim CmdB As New OleDb.OleDbCommandBuilder(DataAdapter1)
it give error in update statment
This post has been edited by a_a_s: 18 May 2008 - 09:28 AM