September 28th, 2003, 11:56 AM
oleDbConnection Data Source
For starters, I am using C# to develop a web form.
I am in the stages of connecting my web form to an Access database.
I can access the information just fine; I am just doing some house keeping now trying to get it ready for the web. I am building it on a local machine, but will run it from an outside server.
When I make the connection to the database using an oleDbConnection, the Data Source is in the long form C:\Inetpub\wwwroot\DB\Login. However, this string would not suffice for an actual web server because there is no C:\Inetpub\wwwroot. I can obviously always create a DB directory once I send the files over.
I want to know about how to make the Data Source a generic name (i.e. ..\DB\Login)?
I have tried using ..\DB\Login as the data source and that does not work. The connection is made (according to MS Visual Studio .NET, you can test the connection when first create it), but the oleDbConnection will not open (oleDBConnection.Open()) when I run my code. It will run fine if I leave it as C:\Inetpub\wwwroot\DB\Login, but fails if I use attempt to use ..\DB\Login
Any suggestion on how to make the Data Source and/or Connection generic or is there something I must change before sending it to the web?
Comments on this post