Zack
7/18/2002 10:22:00 PM
Thanks for your help Mahesh. Here are the additional
steps I had to perform, since I hadn't loaded the odbc dll
yet:
1. Download the following dll and reference in app:
Microsoft.Data.Odbc.dll
2. Add the following namespace: using Microsoft.Data.Odbc;
If anyone's interested my code ended up looking like this
for binding to a grid (this is done in ASP.NET):
string connectstring = "Driver{Sybase System
11};srvr=myserver;UID=myuserid;PWD=mypassword;Database=mydb
;";
OdbcDataAdapter da = new
OdbcDataAdapter(thisSqlString, connectstring);
DataSet ds = new DataSet();
da.Fill(ds);
DataGrid1.DataSource = ds;
DataGrid1.DataBind();
(The OdbcConnection() also worked.)
Thanks for your assistance. I wasn't sure if this would
work since Sybase isn't explicity mentioned by MS, but it
does.
Thanks,
Zack
>-----Original Message-----
>Zack Try running this code, it works for me
>
>public int connect()
> {
> string connectstring;
> cn = new OdbcConnection();
> connectstring = "Provider=MSDASQL;Integrate
>Security=SSPI;Persist Security Infoúlse;"+
> "DRIVER={Sybase System 11};UID="
>+ uid + ";PWD=" + pwd +";database="+dbname +";srvr=" +
>srvrname ;
>
> cn.ConnectionString = connectstring;
> cn.Open();
>
> MessageBox.Show("Connection String " +
>GetBaseConnectionString());
>
> return 0;
>
> }
>
>
>
>
>>-----Original Message-----
>>Hi,
>>
>>I've created an ODBC connection using the Sybase System
>11
>>driver. Within dotnet, I'm able to create an
>>SqlConnection object using this ODBC connection.
>Clicking
>>on the "Test Connection" button also succeeds. However,
>>once I try to add an SqlCommand, I receive the following
>>error: "Server does not exist or access denied."
>>
>>I receive the same error when I create the connection
>>string programatically and then attempt to open it.
>>
>>Any suggestions?
>>
>>Thanks,
>>Zack
>>.
>>
>.
>