Problem using DbProviderFactory with a Access 2000 database

  • Thread starter Thread starter Gordon
  • Start date Start date
G

Gordon

Hi;

I can't seem to open an Access 2000 database with the following dbprovider
factory code :

In my source :


Code SnippetDim dp As String = ConfigurationManager.AppSettings("provider")

Dim cnStr As String = _

ConfigurationManager.ConnectionStrings("AFIDConnectionString").ConnectionString

' The factory provider

Dim df As DbProviderFactory = DbProviderFactories.GetFactory(dp)

' Now make the connection object

Dim conn As DbConnection = df.CreateConnection()



In my App config file I have :


Code Snippet<configuration>

<appSettings>

<add key="provider" value="System.Data.OleDb" />

</appSettings>

<connectionStrings>

<add name="AFIDConnectionString"

connectionString="Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=\\wmcrystalt\sysData\FTPFiles\databases\FTPFilesRpts.mdb;" />

</connectionStrings>



When I step through the code in my locals windows I notice that


df {System.Data.OleDb.OleDbFactory} System.Data.Common.DbProviderFactory
+ System.Data.OleDb.OleDbFactory {System.Data.OleDb.OleDbFactory}
System.Data.OleDb.OleDbFactory
CanCreateDataSourceEnumerator False Boolean

Can't you connect to an Access database i.e. MDB through the dbProvider
object ?



Thanks for any insights,
 
Back
Top