|
-
January 21st, 2013, 05:29 AM
#3
Re: Out of Memory and driver could not be loaded due to system error 8
Hi Victor,
Thanks for your response. Yes, the code which i shared was very much inside the try-catch block. Thats the reason i was able catch it and write the error in to a log file.
Basically i am new to c++. Atlease i hope the syntax what i have used to retrieve the data from database is correct and not causing the issue because of that. Following is the code with try-catch
CDatabase DBConnection;
try
{
if(!DBConnection.IsOpen())
{
DBConnection.OpenEx("Driver={SQL Server};Server=10.120.110.30;Database=Test;Trusted_Connection=yes;", CDatabase enReadOnly | 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();
}
catch(CDBException * ex)
{
DBConnection.Close();
TCHAR buf[500];
ex->GetErrorMessage(buf, 500);
CString strPrompt(buf);
CloseHandle(hToken);
RevertToSelf();
WriteToLogFile(strPrompt +" - after connecting to DB");
}
I open the connection using - DBConnection.OpenEx("Driver={SQL Server};Server=10.120.110.30;Database=Test;Trusted_Connection=yes;",
Some code samples in internet shows passing DSN in the connection string. So far i didn't create a DSN explicity and passing it to connection string. Will that make any difference ?
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|