且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

如何使用VB.NET将数据从数据表插入MS访问数据库?

更新时间:2023-02-07 08:39:55

SQLInsertCmd.CommandText = "INSERT INTO AmazonData ( [order-id] ) SELECT [order-id] FROM ImportedData"



以上命令直接传递给Access控制器,它无法从数据表中读取,因为它是一个mem ory对象。您需要使用正确的参数化查询来构建命令,使用数据表的元素填充每个参数。您还需要检查命令的返回值,看它们是否成功。


The above command is passed direct to the Access controller, which has no way of reading from your data table, since it is a memory object. You need to use proper parameterised queries to build your commands, filling each parameter with the elements of your data table(s). You also need to check the return values of your commands to see whether they succeeded or not.