本文介绍了更新要求当传递的DataRow集合与已修改行有效的UpdateCommand的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

所以,我这个工作最后一周了。至少,我想我做到了!http://stackoverflow.com/questions/548091/datagridview-update

So I had this working last week. At least, I thought I did!http://stackoverflow.com/questions/548091/datagridview-update

然后,我开始工作今天再度项目,并正在逐渐

Then I start working on the project again today and am getting

更新要求当传递的DataRow集合与已修改行有效的UpdateCommand。

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

scDB.SSIS_Configurations_StagingDataTable table = (scDB.SSIS_Configurations_StagingDataTable)stagingGrid.DataSource;
myStagingTableAdapter.Update(table);

的StagingTableAdapter有一个附加的查询这需要'过滤'作为参数。这是用来填充gridview的。在向导创建查询我看到'更新生成。我看到大部分的帖子,出现此错误需要用命令生成器生成一个更新语句。我该怎么办?

The StagingTableAdapter has an additional query which takes 'filter' as a parameter. That was used to fill the gridview. In the wizard for creating that query I see 'update was generated'. I see that most posts with this error require that an update statement be generated with a command builder. What do I do?

推荐答案

该错误是相当字面:这种适配器需要一个有效的SQL Update语句。数据集设计师和CommandBuilders会为你生成这些,但并没有什么错手工制作一个位SQL任。

The error is quite literal: The Adapter needs a valid SQL Update statement. Dataset designers and CommandBuilders will generate these for you, but there is nothing wrong with hand-crafting a bit of SQL either.

不管怎样,你必须验证器(Debugger)的更新语句仍配置和它实际上是什么。这可能是更多的是SQL不是C#的问题。

Anyway, you'll have to verify (debugger) that the Update statement is still configured and what it actually is. It could be more of a SQL than a C# problem.

编辑:命令Builder工具将只处理直,单表,Select语句。使用JOIN或任何幻想,你是你自己的。

the Command Builder tools will only handle straight, single table, Select statements. Use a Join or anything fancy and you're on your own.

这篇关于更新要求当传递的DataRow集合与已修改行有效的UpdateCommand的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

11-01 13:43