Networks

Our forums are currently in maintenance mode and the ability to post is disabled. We will be back up and running as soon as possible. Thanks for your patience!

Question

Locked

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

By staffan.bostrom ·
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

This conversation is currently closed to new comments.

Thread display: Collapse - | Expand +

All Answers

Collapse -

Why not simply put the path

by Tony Hopkinson In reply to How to create an OleDb co ...

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.

Related Discussions

Related Forums