SqlConnectionString/ODBC/VS2008

SqlConnectionString/ODBC/VS2008

am 24.04.2008 19:39:52 von GH

I have the following code, in an ASP.NET app, to setup a connection in
code.

string connectionString =
"DSN=Interbase;UID=SYSDBA;DB=C:\\Data\\MEMDATA.GDB;";
SqlConnection con = new SqlConnection(connectionString);

When I try to run the app I get the following error message

System.ArgumentException: Keyword not supported: 'dsn'.

How can I get an ODBC connection, to work with the code above?

TIA

Re: SqlConnectionString/ODBC/VS2008

am 24.04.2008 19:54:52 von Courtney

"gh" wrote in message
news:uYNh3IjpIHA.1772@TK2MSFTNGP03.phx.gbl...
>I have the following code, in an ASP.NET app, to setup a connection in
> code.
>
> string connectionString =
> "DSN=Interbase;UID=SYSDBA;DB=C:\\Data\\MEMDATA.GDB;";
> SqlConnection con = new SqlConnection(connectionString);
>
> When I try to run the app I get the following error message
>
> System.ArgumentException: Keyword not supported: 'dsn'.
>
> How can I get an ODBC connection, to work with the code above?
>
> TIA

Not sure what answer is but check out this page it has as many possible
connection strings as I have seen:

http://www.carlprothman.net/Default.aspx?tabid=81

LS

Re: SqlConnectionString/ODBC/VS2008

am 24.04.2008 19:59:59 von George Ter-Saakov

The SqlConnection is only for MS SQL server.
If you using DSN then you need to use OdbcConnection class

George


"gh" wrote in message
news:uYNh3IjpIHA.1772@TK2MSFTNGP03.phx.gbl...
>I have the following code, in an ASP.NET app, to setup a connection in
> code.
>
> string connectionString =
> "DSN=Interbase;UID=SYSDBA;DB=C:\\Data\\MEMDATA.GDB;";
> SqlConnection con = new SqlConnection(connectionString);
>
> When I try to run the app I get the following error message
>
> System.ArgumentException: Keyword not supported: 'dsn'.
>
> How can I get an ODBC connection, to work with the code above?
>
> TIA

Re: SqlConnectionString/ODBC/VS2008

am 24.04.2008 22:49:16 von mark

"gh" wrote in message
news:uYNh3IjpIHA.1772@TK2MSFTNGP03.phx.gbl...
??
>I have the following code, in an ASP.NET app, to setup a connection in
> code.
>
> string connectionString =
> "DSN=Interbase;UID=SYSDBA;DB=C:\\Data\\MEMDATA.GDB;";
> SqlConnection con = new SqlConnection(connectionString);
>
> When I try to run the app I get the following error message
>
> System.ArgumentException: Keyword not supported: 'dsn'.
>
> How can I get an ODBC connection, to work with the code above?

You're using SqlConnection - that's only for SQL Server. If you absolutely
must use ODBC, then you need OdbcConnection.

But why are you trying to use ODBC when there is a perfectly good native
..NET data provider available...?
http://cc.codegear.com/item/25298


--
Mark Rae
ASP.NET MVP
http://www.markrae.net