vb.net 不返回任何键列信息的 SelectCommand 不支持 UpdateCommand 的动态 SQL 生成

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14045901/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 16:32:08  来源:igfitidea点击:

Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information

vb.netms-access

提问by user1930629

I want update/edit data in database (MS Access) by using DataGridView in VB.net I used this code:

我想通过在 VB.net 中使用 DataGridView 更新/编辑数据库(MS Access)中的数据我使用了以下代码:

       Dim sadapter As OleDb.OleDbDataAdapter
       Dim sds As DataSet
       sadapter.Update(sds, "marks") 

then showing this message:

然后显示此消息:

Dynamic SQL generation for the UpdateCommand is not supported against a SelectCommand that does not return any key column information.

对于不返回任何键列信息的 SelectCommand,不支持 UpdateCommand 的动态 SQL 生成。

回答by Nashath Nasik

If you table doesn't have a primary key, you need to set one.

如果您的表没有主键,则需要设置一个。