I have some legacy ODBC connection coding which uses the SQLGetInfo function to gather various connection details when requested. The code is currently being re-factored to .NET, however it still has to maintain a small amount backward compatibility until the remaining areas are also re-factored into .NET
I need to be able to reproduce the follow c++ code using c# OdbcConnection.GetSchema()
char strInstanceName[200];
SQLSMALLINT lengthReturned;
SQLGetInfo(myhInstance, SQL_SERVER_NAME, strInstanceName, 200, &lengthReturned);
char strDSN[200];
SQLSMALLINT lengthReturned;
SQLGetInfo(myhInstance, SQL_DATA_SOURCE_NAME, strDSN, 200, &lengthReturned);
char strActiveStmts[200];
SQLSMALLINT lengthReturned;
SQLGetInfo(myhInstance, SQL_ACTIVE_STATEMENTS, strActiveStmts, 200, &lengthReturned);
char strActiveConns[200];
SQLSMALLINT lengthReturned;
SQLGetInfo(myhInstance, SQL_ACTIVE_CONNECTIONS, strActiveConns, 200, &lengthReturned);
I’ve spent hours looking over the documentation and searching the web, but I’m unable to find or understand what the equivalent is using OdbcConnection.GetSchema(), even though the documentation and web lead me to believe this is the function to get all this information.
Example code would be nice 🙂
Regards
DIG’s
Answered via the MSDN forum.
Basically the info I require isnt obtianable through the .NET framework, I need to call the ODBC API directly in c# using InteropServices and DllImport.
http://social.msdn.microsoft.com/Forums/en-US/netfxbcl/thread/4579ccbc-4977-493e-a863-94ecdfe181b4/#9d74fc73-7be9-482b-b6db-1b4c256cb355
DIG’s