Help with generated update statements

frankdaniels

Member
Joined
Jan 27, 2006
Messages
10
Programming Experience
Beginner
Any help would be appreciated. I am trying to understand datagridviews. I have tried everything and searched everywhere, but am so frustrated with the myriad of information to trawl through, I am getting suicidal. I have created a form with a datagrid view and a button. I have added the binding source, configured the dataset and the adapter has been created.

The form loads, and the data is loaded into the datagridview. Fine. all is well up to here. When configuring the adapter, a little message bow told me that the insert,delete,update etc etc were generated.

So please tell me in the simplest way possible, do you update the DATABASE with any changes made in the datagrid.

I cannot get this one simple thing to work. I have tried everything I can think of:

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Me.TeamweeklyTableAdapter.Update(Me.ReportsDataSet.teamweekly)
End Sub

When I click the button, this error message appears:

"Update requires a valid UpdateCommand when passed DataRow collection with modified rows."

Why, why, why. If the update statements were automatically gereated, why is this happening. If anyone knows how to assist me, please, please,please do. I have tried many forums, and searched all over, been referred here there and everywhere, bought books and paid subscriptions. But am no nearer to understanding this F***** control.

Thanks.
 
:) you may be what you wrote in original thread title, but I don't think anybody in a programming forum can help you with that. heheh - so I did what you should do if you seek help for programming questions, changed the thread title to something descriptive and relevant to the problem at hand... Title "Help with generated update statements" will hopefully attract somebody with the knowledge that want to help you.
 
The quickest way to get familiar with the add, edit, delete functions is to let the dataform wizard generate the code for you. Create a form with the same dataset and select statement. Choose a grid form and all the code for update and delete will be created for you. Copy and paste and you are done.
 
Back
Top