|
|
|
Get DSN List in C++/CLI
1
I saw a few samples where this was possible in C#, but nothing in C++/CLI. It should be fairly similar but there was one key difference... int instead of IntPtr.
#define SQL_SUCCESS 0
#define SQL_SUCCESS_WITH_INFO 1
#define SQL_NO_DATA 100
#define SQL_ERROR (-1)
#define SQL_INVALID_HANDLE (-2)
#define SQL_STILL_EXECUTING 2
#define SQL_NEED_DATA 99
#define SQL_FETCH_NEXT 1
#define SQL_FETCH_FIRST 2
#define SQL_HANDLE_ENV 1
#define SQL_HANDLE_DBC 2
#define SQL_HANDLE_STMT 3
#define SQL_HANDLE_DESC 4
[System::Runtime::InteropServices::DllImport("odbc32.dll")]
extern "C" short _cdecl SQLAllocEnv(int% EnvironmentHandle);
[System::Runtime::InteropServices::DllImport("odbc32.dll")]
extern "C" short _cdecl SQLDataSources(int EnvironmentHandle, short Direction, StringBuilder^ ServerName, short BufferLength1, short% NameLength1Ptr, StringBuilder^ Description, short BufferLength2, short% NameLength2Ptr);
[System::Runtime::InteropServices::DllImport("odbc32.dll")]
extern "C" short _cdecl SQLFreeHandle(short HandleType, int Handle);




There are currently no comments for this snippet.