I'm still having problems accessing the static member of CDatabase,
henvAllConnections. Here is an example of my code:
void CMyDatabase::Open() // derived from CDatabase
{
AllocConnect(); // Just in case henvAllConnections isn't connected
yet
char acDSN[SQL_MAX_DSN_LENGTH+1];
char acDesc[256];
short iDSNLen;
short iDescLen;
CStringArray astr;
::SQLDataSources(CDatabase::henvAllConnections,
SQL_FETCH_FIRST, (unsigned char*)&acDSN,
SQL_MAX_DSN_LENGTH, &iDSNLen,
(unsigned char*)&acDesc, 256, &iDescLen);
astr.Add(acDSN);
while(::SQLDataSources(CDatabase::henvAllConnections,
SQL_FETCH_NEXT, (unsigned char*)&acDSN,
SQL_MAX_DSN_LENGTH, &iDSNLen,
(unsigned char*)&acDesc, 256, &iDescLen)
== SQL_SUCCESS)
astr.Add(acDSN);
// Should give me an array of CString's in "astr" for more processing
// …
}
I get a return value of SQL_INVALID_HANDLE. The debugger reports
CDatabase::henvAllConnections does have a value.