tags:

views:

50

answers:

1

Is there any way to set the default database of an ODBC DSN, using the ODBC connection string in an OdbcConnection?

Edit: If I already have a DSN setup and a normal connection works.

OdbcConnection connection = 
    new OdbcConnection("DSN=TestDSN;UID=ADMIN;PWD=****;");

Is there a way I can change the default connection that is set when you create the DSN in Control Panel->Administrative Tools->Data Sources(ODBC) through the connection string.

A: 

Often you can add "Initial Catalog" or something similar to the connection string to start off in that database. What that key is named is going to vary based on what you're actually connecting to.

http://connectionstrings.com/ is a pretty good resource for looking up the details.

UnwashedMeme