Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

ODBC access to MS-Access freezes taskbar

Status
Not open for further replies.

wesleyer

Programmer
Oct 9, 2001
1
CA
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(&quot;DSN=MRWork;&quot;);
CRecordset qry(&con);
try
{
qry.Open(AFX_DB_USE_DEFAULT_TYPE, _T(&quot;select * from RTMErrorMessages where code = 10000&quot;));
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);
}
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top