Click here to Skip to main content
15,896,269 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all visitors

I have a problem with update my data in sql server 2005.
I use like this:
VB
dataadapter.update(bindingsource.datasource)

after than will display an error like this:
Update requires a valid UpdateCommand when passed DataRow collection.

Please help me
Best Regards,
Posted
Updated 10-Mar-12 21:42pm
v2
Comments
ProEnggSoft 11-Mar-12 3:43am    
Edit: pre tag for VB.NET code and code tags added - PES

Solving a problem is easiest when you have exact error message. You just need to Google for it.

So is your case. See the link - Error - Update requires a valid UpdateCommand when passed DataRow collection[^].

BTW the error message here is pretty self explaining. You haven't defined an UpdateCommand for the BindingSource. To update something against database, an update query is required and you will need to specify one like this - bindingsource.UpdateCommand = "Update Query here";

Hope this helps!
 
Share this answer
 
take a look there it maybe help you

[^]
 
Share this answer
 
I have a suggestion.
Please take a look at this article.
General purpose class to fill DataTable(s) from DataBase and to save DataTable(s) to DataBase using reflection[^]

Using this general purpose class you can fill DataTable(s) from database and save DataTable(s) to database easily.

The sample code given in the article is in C#.
You can use the code converter at Telerik.com
http://converter.telerik.com/[^]
to convert the C# code to VB.NET code
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900