Problem using DbProviderFactory with a Access 2000 database

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,
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top