vb.net Access 数据库错误“找不到文件”?

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/14525477/
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-17 12:02:08  来源:igfitidea点击:

Access database error "Could not find file"?

asp.netvb.net

提问by Chidi Okeh

I have been using Access database as db of choice for a long time now and this is the first time I have run into the following error message:

很长一段时间以来,我一直使用 Access 数据库作为首选数据库,这是我第一次遇到以下错误消息:

Could not find file 'C:\Program Files\Common Files\Microsoft Shared\DevServer.0\dbo.mdb'

First, I don't have a db called dbo.mdb.

首先,我没有名为 dbo.mdb 的数据库。

Second, the path to the db is defined in my web.config file thus:

其次,db 的路径在我的 web.config 文件中定义,因此:

<connectionStrings>
<add name="cingconstrng" connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\wwwroot\Roster\App_Data\AllStars.mdb" providerName="System.Data.OleDb" />
</connectionStrings>

Funniest part is that I am passing the connection string to some files without problem.

最有趣的部分是我将连接字符串传递给某些文件没有问题。

So, why is it different with this file?

那么,为什么这个文件不同呢?

Is it because I am inserting records into the db with with this file?

是因为我用这个文件将记录插入到数据库中吗?

Any ideas is greatly appreciated. I have been working on this issue since last night and googling hasn't provided any solutions.

任何想法都非常感谢。我从昨晚开始就一直在研究这个问题,谷歌搜索没有提供任何解决方案。

回答by John Koerner

You can see this behavior if your SQL statements use namespaces:

如果您的 SQL 语句使用命名空间,您可以看到这种行为:

INSERT INTO dbo.someTable ...

Remove the namespace and it should correct the issue.

删除命名空间,它应该可以解决问题。