Question Locked

How to create an OleDb connection using ADO.net 3.5.

0 helpful
2 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

How do I create an OleDb connection to an MS Access database that may be placed differently on different executing machines?

I create a database app on my local PC using VS 2008. The connection string contains a hardcoded absolute path to my Access database (can be picked up from web.config)and that is OK as long as I have full control of its location.
When the app is useful, I want to move it to a web hotel and my database file will be placed somewhere relative to my personal webroot on the web server. I am able to create a DSN on the web server, but OleDb does not seem to be able to use that information to connect to my database.

So, how do I create a connection string using a relative path to my database?

Staffan

2 replies

by tony hopkinson

in a config file, look it up and a build the connection string. A DSN does little for you anyway it's just a resgistry entry with some trimmings.

This discussion is closed to new replies.