|
EVC连接SQLCE出问题:recordset 的open方法总是提示:first—chance exception in XX.exe:0X0
[复制链接]
EVC连接SQLCE出问题:recordset 的open方法总是提示:first—chance exception in XX.exe:0X00000f0:stack overflow。
程序如下
CVOConnection* m_Conn;
CVORecordset* m_pRecordSet
BOOL CACDSDlg::OnInitDialog()
{
m_Conn = new CVOConnection();
m_pRecordSet = new CVORecordset(*m_Conn);
CString sql = L"select * from student";
m_pRecordSet- >Open(sql);
}
CVORecordset的open方法如下:
BOOL CVORecordset::Open(CString ctrSQL)
{
if(!m_rsRecordSet)
{
TRACE(TEXT("CVORecordset::Open() RecordSet COM Object not initialized\n"));
return FALSE;
}
VARIANT varTSQL,varEmpty;
HRESULT hr;
VariantInit(&varEmpty);
VariantInit(&varTSQL);
varTSQL.bstrVal = SysAllocString(ctrSQL);
varTSQL.vt = VT_BSTR;
if(IsOpen())
m_rsRecordSet- >Close();
hr = m_rsRecordSet- >Open(varTSQL, varEmpty, adOpenDynamic, adLockOptimistic,adCmdUnknown);
m_bIsOpen = (!FAILED(hr));
return m_bIsOpen;
}
当程序运行至hr = m_rsRecordSet- >Open(varTSQL, varEmpty, adOpenDynamic, adLockOptimistic,adCmdUnknown);时产生上面的错误。
当我在EVC自带的standsdk中运行这个程序是没有错误的,但当在我自己定制的系统里运行就产生上面的问题。是操作系统定制的问题么?可是我有一个例子,也是用的这个相同的程序,在我自己定制的系统中运行就没有问题,怪!!!!!!
请大虾指点,小弟跪谢了!
|
|