SqlConnectionString\ODBC\VS2008

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
GH [ Do, 24 April 2008 19:39 ] [ ID #1949178 ]

Re: SqlConnectionString\ODBC\VS2008

"gh" <gh [at] att.net> wrote in message
news:uYNh3IjpIHA.1772 [at] 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
Courtney [ Do, 24 April 2008 19:54 ] [ ID #1949179 ]

Re: SqlConnectionString\ODBC\VS2008

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

George


"gh" <gh [at] att.net> wrote in message
news:uYNh3IjpIHA.1772 [at] 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
George Ter-Saakov [ Do, 24 April 2008 19:59 ] [ ID #1949180 ]

Re: SqlConnectionString\ODBC\VS2008

"gh" <gh [at] att.net> wrote in message
news:uYNh3IjpIHA.1772 [at] 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
mark [ Do, 24 April 2008 22:49 ] [ ID #1949198 ]
Microsoft » microsoft.public.dotnet.framework.aspnet » SqlConnectionString\ODBC\VS2008

Vorheriges Thema: Master Page Properties persist?
Nächstes Thema: usign Skype from .NET