TableAdapter.update方法,到哪里去了?
我用你的标准智能控制东西制作了一个列表框,并将其连接到数据库。它获取我通过查询生成器预先生成的数据,所以当我这样做时:
this.calibrate_swipesTableAdapter.Fill(this.xperdex_crandallDataSet.calibrate_swipes);
我得到一个包含我的数据的列表框。
然后,当我向其中添加一大块数据时,通过以下方式:
toadd["card_number"] = card_number;
this.xperdex_crandallDataSet.Tables["calibrate_swipes"].Rows.Add(toadd);
它也可以工作。效果很好。现在,当我关闭时,我会丢失所有信息。更新我的适配器和 AcceptChanges,对吗?
没那么快。当我打电话时
this.calibrate_swipesTableAdapter.Update(this.xperdex_crandallDataSet.calibrate_swipes);
,我得到“不包含‘更新’的定义”。
什么给?我不明白为什么执行填充的同一件事没有更新方法。
I made a ListBox with your standard smart-control thing, and have it connected to a database. It gets the data I've pre-generated in there via query builder, so when I do this:
this.calibrate_swipesTableAdapter.Fill(this.xperdex_crandallDataSet.calibrate_swipes);
I get a listbox with my data.
THEN, when I add a chunk of data to it, via this:
toadd["card_number"] = card_number;
this.xperdex_crandallDataSet.Tables["calibrate_swipes"].Rows.Add(toadd);
It also works. It works great. Now, when I close, I lose all my information. Update my adapter and AcceptChanges, right?
Not so fast. When I call
this.calibrate_swipesTableAdapter.Update(this.xperdex_crandallDataSet.calibrate_swipes);
I get "does not contain a definition for 'update'".
What gives? I don't see any reason why the same thing that does the filling, wouldn't have an update method.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
您可能需要查看TableAdapter 概述其中指出:
您有两个选择:
要更改 UpdateCommand,请找出为 TableAdapter 生成的类的名称。代码应如下所示:
更新:
正如评论者所说,还有其他情况可能无法生成命令。 查看评论。
You may want to take a look at TableAdapter Overview which states:
You have two choices:
To change the UpdateCommand, find out what's the name of the class generated for the TableAdapter. The code should look something like the following:
UPDATE:
As commenters said, there are other conditions for which the commands may not be generated. See the comments.