views:

25

answers:

1

Hello,

I have a dBase file that I want to set up as a database. I was thinking of setting up an ODBC DSN system connection and connect using this. How do I set this up in an asp.net web.config file and use it

<connectionStrings configSource="MyFolder\database.config" />

Inside Database file

<connectionStrings> My Connection Here???</connectionStrings>
A: 

I personally use OleDb to connect to FoxPro data, but you might connect using ODBC this way:

string connectionString = "DSN=" + ConfigurationManager.AppSettings["myDSN"];
OdbcConnection connection = new OdbcConnection(connectionString);
connection.Open();

//do something

In your web.config file:

<appSettings>
    <add key="myDSN" value="DSN Name"/>
</appSettings>

I've tested this and it works

Brian Vander Plaats