problem connecting to access database in asp.net 2.0
hi im trying to get a dataset from an access database
im using this connection string:
<connectionStrings>
<add name="SiteConnString" connectionString="Data Source=c:\inetpub\vhosts\db\mainDB.mdb"
providerName="Microsoft.Jet.OLEDB.4.0" />
</connectionStrings>
and this is my call to SqlHelper:
myDataSet = SqlHelper.ExecuteDataset(connString, CommandType.Text, strSQL);
开发者_StackOverflow中文版
and the error im getting is this:
A network-related or instance-specific error occurred while establishing a connection to SQL Server. The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server is configured to allow remote connections. (provider: SQL Network Interfaces, error: 26 - Error Locating Server/Instance Specified)
The providerName attribute expects an ADO.NET provider class name. Try changing your connection like so:
<connectionStrings>
<add name="SiteConnString"
connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=c:\inetpub\vhosts\db\mainDB.mdb"
providerName="System.Data.OleDb" />
</connectionStrings>
A very handy reference for connection string formats is http://connectionstrings.com
精彩评论