I am getting "driver could not be loaded due to system error 8" error while connecting to SQL Server 2005 from VC++. Its also throwing out of memory error. Basically i am developing and ISAPI dll. I use the following code to connect to DB.

CDatabase DBConnection;

if(! DBConnection.IsOpen())
{

DBConnection.OpenEx("Driver={SQL Server};Server=10.120.110.30;Database=Test;Trusted_Connection=yes;", CDatabase:penReadOnly | CDatabase::noOdbcDialog);
}

CRecordset RecSet(&DBConnection);
RecSet.Open(CRecordset::forwardOnly,_T("{CALL SP_GetDetails('" + Username +"','403')}"));
while(!RecSet.IsEOF())
{
RecSet.GetFieldValue((short)0,strValue);
RecSet.MoveNext();
}

RecSet.Close();

DBConnection.Close();

I am new to C++. Can anybody please help to verify my code?. Also, for CDatabaseConnection, i can see 2 different method to open the connection, OpenEx and Open. Whats the difference between OpenEx and Open?