简体   繁体   English

VB.NET中的MS Access数据库

[英]MS access database in VB.NET

I followed a tutorial on the internet to create my own database. 我按照互联网上的教程创建自己的数据库。 I succesfully built a program upon it. 我成功地在其上构建了一个程序。 Then I created an access .mdb file(another database) and then I just changed the database which the program connected to, to the one which I created. 然后,我创建了一个访问.mdb文件(另一个数据库),然后将程序连接到的数据库更改为我创建的数据库。

I just made that one change. 我只是做了一个更改。 But then it started showing me error whenever I tried to update using 但是,当我尝试使用进行更新时,它开始向我显示错误

da.update(ds,"Phone Book")  

where da is data adapter and ds is data set. 其中da是数据适配器,而ds是数据集。

The error was: " syntax error in INSERT INTO statement" 错误是:“ INSERT INTO语句中的语法错误”

I have just changed the DB that the program is connecting to. 我刚刚更改了程序正在连接的数据库。 I did not change the code one bit. 我一点也没有更改代码。

EDIT: I forgot to mention, I searched for this on google, and one thing which I read was, that access database might be only read only or something. 编辑:我忘了提及,我在Google上搜索了此内容,而我读到的一件事是,访问数据库可能是只读的或某种东西。 But I unchecked the read only box, so I don't know whether it still might be the problem. 但是我没有选中只读框,所以我不知道它是否仍然可能是问题所在。 Although, I don't think there is a problem with the code 虽然,我认为代码没有问题

EDIT: I just discovered now, that even if I change the table which is being referred to, it throws up the same error. 编辑:我现在才发现,即使我更改所引用的表,它也会引发相同的错误。

It sounds like the first database probably used something like Sql Server Express. 听起来第一个数据库可能使用了Sql Server Express之类的东西。 That's a completely different kind of database then Access, with a different providers, different dialect of SQL, connection string, etc. Why would you think you can change all that without breaking some of your code? 与Access相比,这是一种完全不同的数据库,具有不同的提供程序,不同的SQL方言,连接字符串等。为什么您认为可以在不破坏某些代码的情况下进行所有更改?

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM