Hello All -

I've got a couple of .NET Windows forms that have associated
OleDbDataAdapters and OleDbConnection. What is the best approach to
implementing a method for configuring the location of the underlying
data source.

I would like to be able to toggle (in code) between Development, Test,
and Production databases. Lets say for example:

dev db: "c:\databases\dev\myDB.mdb"
test db: "s:\databases\test\myDB.mdb"
prod db: "s:\databases\prod\myDB.mdb"

It seems like I need to set the connection's DataSource property prior
to establishing a connection. But if the connection is associated
with the form, how can I configure the connection in code prior to
loading the form?

Thanks!
Dave

Re: OleDbConnection DataSource configuration in code by Manoj

Manoj
Wed Dec 03 02:41:36 CST 2003

Why dont u just store connection info in a configuration file? You can
convineantly have three key values (dev, test, prod) in your appSettings
node in the config file and toggle between them as needed in your code using
ConfigurationSettings.AppSettings function.


--
HTH,
Manoj G [.NET MVP]
http://www15.brinkster.com/manoj4dotnet

"dave" <thorung@mailcity.com> wrote in message
news:f9e0449e.0312021730.79b80ed3@posting.google.com...
> Hello All -
>
> I've got a couple of .NET Windows forms that have associated
> OleDbDataAdapters and OleDbConnection. What is the best approach to
> implementing a method for configuring the location of the underlying
> data source.
>
> I would like to be able to toggle (in code) between Development, Test,
> and Production databases. Lets say for example:
>
> dev db: "c:\databases\dev\myDB.mdb"
> test db: "s:\databases\test\myDB.mdb"
> prod db: "s:\databases\prod\myDB.mdb"
>
> It seems like I need to set the connection's DataSource property prior
> to establishing a connection. But if the connection is associated
> with the form, how can I configure the connection in code prior to
> loading the form?
>
> Thanks!
> Dave