Question How to update a table using dataset

kbsudhir

Member
Joined
Jun 13, 2008
Messages
21
Programming Experience
Beginner

Hi All,

I am using VB 2008.
I want to update my table in SQL 2008.
I am displaying the data in a data grid view
I am changing some data in the datagrid view.

And want to update the same in my table. How to do so....???

I am using the below code to uodate the data in the table on a button click.
Below is the code.
VB.NET:
Expand Collapse Copy
Private Sub SaveButton_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles SaveButton.Click
        TableCollectionTableAdapter.Update(Collection)
    End Sub

I am getting an error on the below line:
VB.NET:
Expand Collapse Copy
TableCollectionTableAdapter.Update(Collection)

Below is the error which I am getting:

HTML:
Expand Collapse Copy
System.InvalidOperationException was unhandled
  Message="Update requires a valid UpdateCommand when passed DataRow collection with modified rows."
  Source="System.Data"


Please guide on how to update the same in my table. How to do so....???

:confused::confused:

Regards
Sudhir
 
Back
Top