The windows taskbar freezes during the execution of the code below, i.e., no program can be started through the 'start' menu. The code opens an MS-Access database and executes a query (using ODBC) with a "where" clause over an integer column. If the "where" clause is removed or it is done over a string column, the taskbar doesn't freeze. This behavior doesn't happen in all machines.
Environment:
WindowsNT 4.0 SP 5
MDAC 2.5 SP2 or 2.6
MS VC++ 6.0
Do you have any tips on how to solve this ?
Thanks,
Wesley
#include <iostream>
#include <string>
#include <afxdb.h>
#include <afxmt.h>
using namespace std;
void main()
{
CDatabase con;
con.OpenEx("DSN=MRWork;"
CRecordset qry(&con);
try
{
qry.Open(AFX_DB_USE_DEFAULT_TYPE, _T("select * from RTMErrorMessages where code = 10000");
while (qry.IsEOF() == false)
{
CDBVariant value;
qry.GetFieldValue(1, value, DEFAULT_FIELD_TYPE);
string str = (LPCTSTR)*value.m_pstring;
cout << str;
qry.MoveNext();
}
}
catch (CDBException* ex)
{
cerr << ex->m_nRetCode << endl;
cerr << (const char*) ex->m_strError << endl;
cerr << (const char*) ex->m_strStateNativeOrigin << endl;
}
qry.Close();
con.Close();
Sleep(100000000);
}
Environment:
WindowsNT 4.0 SP 5
MDAC 2.5 SP2 or 2.6
MS VC++ 6.0
Do you have any tips on how to solve this ?
Thanks,
Wesley
#include <iostream>
#include <string>
#include <afxdb.h>
#include <afxmt.h>
using namespace std;
void main()
{
CDatabase con;
con.OpenEx("DSN=MRWork;"
CRecordset qry(&con);
try
{
qry.Open(AFX_DB_USE_DEFAULT_TYPE, _T("select * from RTMErrorMessages where code = 10000");
while (qry.IsEOF() == false)
{
CDBVariant value;
qry.GetFieldValue(1, value, DEFAULT_FIELD_TYPE);
string str = (LPCTSTR)*value.m_pstring;
cout << str;
qry.MoveNext();
}
}
catch (CDBException* ex)
{
cerr << ex->m_nRetCode << endl;
cerr << (const char*) ex->m_strError << endl;
cerr << (const char*) ex->m_strStateNativeOrigin << endl;
}
qry.Close();
con.Close();
Sleep(100000000);
}