[lnkForumImage]
TotalShareware - Download Free Software

Confronta i prezzi di migliaia di prodotti.
Asp Forum
 Home | Login | Register | Search 


 

Forums >

microsoft.public.dotnet.framework.odbcnet

Setting Connection Attributes

Rich Boyle

1/17/2003 2:46:00 PM

Is there any way to do a SQLSetConnectAttr using ODBC.NET? The driver I am
using is licensed and requires the driver to be unlocked using
SQLSetConnectAttr. In Win32, I use the following code:

SQLSetConnectAttr(Sql_hdbc, 1041, "xxxx.xxx", 8);
SQLSetConnectAttr(Sql_hdbc, 1042, "xxxxxxxxxxxxxxxxxxxxxxxx", 24);

I have used these drivers with ATL, and used the following code:

CCommand< CNoAccessor, CNoRowset > command;
command.Open(m_session, "{xxxx.xxx,xxxxxxxxxxxxxxxxxxxxxxxx}", NULL, NULL,
DBGUID_DBSQL, false);

I tried the following code in ODBC.NET:

OdbcCommand cmd;

cmd = new OdbcCommand("{xxxx.xxx,xxxxxxxxxxxxxxxxxxxxxxxx}", cn);
cmd.ExecuteNonQuery():

I had some limited success with this approach, it worked with one version of
the driver, but it did not work with an older version of the driver. The
Win32 and ATL code works with both versions of the driver.