如何在Vb.net中使用BindingSource更新数据库 [英] How to update database using BindingSource in Vb.net

查看:801
本文介绍了如何在Vb.net中使用BindingSource更新数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好所有访客

我在更新sql server 2005中的数据时遇到问题.
我这样使用:

Hi all visitors

I have a problem with update my data in sql server 2005.
I use like this:

dataadapter.update(bindingsource.datasource)


之后,将显示如下错误:
传递DataRow 集合时,更新需要有效的UpdateCommand .

请帮帮我
最好的问候,


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

Please help me
Best Regards,

推荐答案

当您收到确切的错误消息时,最容易解决问题.您只需要使用Google.

您的情况也是如此.查看链接-
希望对您有所帮助!
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!


在那里看看,也许对您有帮助

[ ^ ]
take a look there it maybe help you

[^]


我有个建议.
请看一下这篇文章.
用于从DataBase和使用反射将DataTable保存到数据库中 [ http://converter.telerik.com/ [ ^ ]
将C#代码转换为VB.NET代码
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


这篇关于如何在Vb.net中使用BindingSource更新数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆