Hi..
I'm using VC6++ with window xp..
and my coding is like below..
try
{
CString szConn;
hrResult = m_Connection.CreateInstance(__uuidof(Connection));
if(SUCCEEDED(hrResult))
{
szConn = "Provider=Microsoft.JET.OLEDB.4.0;Data
source=C:\\PSMotion\\Database\\IO.mdb";
_bstr_t bstrConn(szConn);
hrResult = m_Connection->Open(bstrConn,"Admin","",-1);
if(SUCCEEDED(hrResult))
{
_CommandPtr pCommandResult;
_variant_t vtEmpty1(DISP_E_PARAMNOTFOUND,
VT_ERROR);
_variant_t vtEmpty2(DISP_E_PARAMNOTFOUND,
VT_ERROR);
sprintf(sql,"DELETE * FROM IOList");
_bstr_t bstrResult(sql);
pCommandResult.CreateInstance(__uuidof(Command));
pCommandResult->ActiveConnection =
m_Connection.GetInterfacePtr();
pCommandResult->CommandText = bstrResult;
pCommandResult->Execute(&vtEmpty1, &vtEmpty2,
adCmdText);
for(int i=0; i<m_poProperty->m_iTotalSignal; i++)
{
sprintf(sql,"INSERT INTO IOList (SignalName,
Pattern, Port, Type, Address, Mapping)
VALUES('%s','%s',%d,%d,'%s','%s')",
m_poProperty->m_szMapping
[i].szSignalName, m_poProperty-
>m_szMapping[i].szPattern,
m_poProperty->m_szMapping[i].iPort,
m_poProperty->m_szMapping[i].bType,
m_poProperty->m_szMapping
[i].szAddress, m_poProperty-
>m_szMapping[i].szName);
_bstr_t bstrResult(sql);
pCommandResult.CreateInstance(__uuidof
(Command));
pCommandResult->ActiveConnection =
m_Connection.GetInterfacePtr();
pCommandResult->CommandText= bstrResult;
pCommandResult->Execute
(&vtEmpty1, &vtEmpty2, adCmdText);
}
pCommandResult.Release();
}
}
if(m_Connection)
{
m_Connection->Close();
m_Connection.Release();
}
}
// ** Error Checking
catch(...)
{
if(m_Connection)
{
m_Connection->Close();
m_Connection.Release();
}
CWnd oWnd;
oWnd.MessageBox("Open Database Error", "Database", MB_OK |
MB_ICONSTOP);
}
when coding comes to pCommandResult->Execute(&vtEmpty1, &vtEmpty2, adCmdText);, will jump to catch.., i don't know what happen on it..but only my PC will not happen this error. If i run this program in other PC, same error will prompt out..
pls advise..
regards,
shizu