Tuesday, February 14, 2012

Connecting to SQL via ODBC : How to change the default database configured with DSN

Hello All,

Does anybody know how to achive that?

<

addname="ConnectionString"connectionString="Dsn=dsn_name;uid=user;pwd=password"providerName="System.Data.Odbc" />

I have got this created by the wizard for my sqlDataSource. I am able to get data from tables in the default database specified with the DSN.

But I want to go to other database than the default.

Thanks a lot in advamce for your help!

Kazu

DSN is tied to a particular database, which in your case is the default database. You can either a) create a new DSN and link it with the database you want to connect with or b) rewrite the connection string so that you aren't using a DSN. this link should help you write the connection stringhttp://www.sqlstrings.com/SQL-Server-connection-strings.htmhttp://www.sqlstrings.com/SQL-Server-connection-strings.htm

|||

thanks. But..

> DSN is tied to a particular database...

Not really. I have finally achived what I wanted, by simply adding "Database=" parameter to the connectionstring.

|||

> DSN is tied to a particulardefault database... Wink

No comments:

Post a Comment