使用Microsoft Access数据库创建ASP.NET网站时出错

时间:2022-07-08 15:38:57

I am creating a simple C# CMS system using a Microsoft Access database

我正在使用Microsoft Access数据库创建一个简单的C#CMS系统

This is my connection string in the web.config file

这是我在web.config文件中的连接字符串

<add name="VirtualCMSConnectionString" connectionString="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=|DataDirectory|ASPNetDB.mdb" providerName="System.Data.OleDB"/>

I have used the "Access Provider" module found here: http://blog.krisvandermast.com/UsingAccessInsteadOfSQLServerForYourASPNETApplicationServices.aspx

我使用了这里的“访问提供商”模块:http://blog.krisvandermast.com/UsingAccessInsteadOfSQLServerForYourASPNETApplicationServices.aspx

The problem I am having is that when I try to create a Dataset with the dataset designing I recieve an error when I try to choose the connection string for the table adapter.

我遇到的问题是,当我尝试使用数据集设计创建数据集时,当我尝试为表适配器选择连接字符串时,我收到错误。

Failed to open a connection to the database

无法打开与数据库的连接

"Cannot obtain provider factory for data provider named 'System.Data.OleDb'

“无法获取名为'System.Data.OleDb'的数据提供程序的提供程序工厂

Check the connection and try again

检查连接,然后重试

Could anyone please help me on this matter.

有谁可以帮我解决这个问题。

Thanks.

1 个解决方案

#1


Have you downloaded the .vsi, extracted it, built the SampleAccessProviders.dll and added it to your project?

您是否下载了.vsi,将其解压缩,构建了SampleAccessProviders.dll并将其添加到您的项目中?

Now that we have created the assembly it's time to actually use it. Open your Visual Studio or Visual Web Developer Express and create a new website. In the project you create a new subfolder called bin. After creation right click on it and choose Add existing item... from the context menu that appears. Navigate to the place where the built assembly is. Add it to the bin folder of the website project. After that repeat the same thing with the access database (ASPNetDB.mdb) file but this time put it in the dedicated folder App_Data which is one of the predefined ASP.NET 2.0 subfolders.

现在我们已经创建了程序集,现在是时候实际使用它了。打开Visual Studio或Visual Web Developer Express并创建一个新网站。在项目中,您将创建一个名为bin的新子文件夹。创建后,右键单击它,然后从出现的上下文菜单中选择添加现有项....导航到构建的程序集所在的位置。将其添加到网站项目的bin文件夹中。之后,使用访问数据库(ASPNetDB.mdb)文件重复相同的操作,但这次将其放在专用文件夹App_Data中,该文件夹是预定义的ASP.NET 2.0子文件夹之一。

#1


Have you downloaded the .vsi, extracted it, built the SampleAccessProviders.dll and added it to your project?

您是否下载了.vsi,将其解压缩,构建了SampleAccessProviders.dll并将其添加到您的项目中?

Now that we have created the assembly it's time to actually use it. Open your Visual Studio or Visual Web Developer Express and create a new website. In the project you create a new subfolder called bin. After creation right click on it and choose Add existing item... from the context menu that appears. Navigate to the place where the built assembly is. Add it to the bin folder of the website project. After that repeat the same thing with the access database (ASPNetDB.mdb) file but this time put it in the dedicated folder App_Data which is one of the predefined ASP.NET 2.0 subfolders.

现在我们已经创建了程序集,现在是时候实际使用它了。打开Visual Studio或Visual Web Developer Express并创建一个新网站。在项目中,您将创建一个名为bin的新子文件夹。创建后,右键单击它,然后从出现的上下文菜单中选择添加现有项....导航到构建的程序集所在的位置。将其添加到网站项目的bin文件夹中。之后,使用访问数据库(ASPNetDB.mdb)文件重复相同的操作,但这次将其放在专用文件夹App_Data中,该文件夹是预定义的ASP.NET 2.0子文件夹之一。