IDispatch error #3092
我程序代码如下发生了IDispatch error #3092
bool CFifNumDlg::IsRepeated(int board[][4])
{
_RecordsetPtr rst1;
CString sql="slect * from fifnum where ";
CString sql1,sql2,sql3,sql4;
rst1=rst;
int count;
sql1.Format("i0=%d and i1=%d and i2=%d and i3=%d and ",board[0][0],board[0][1],board[0][2],board[0][3]);
sql2.Format("i4=%d and i5=%d and i6=%d and i7=%d and ",board[1][0],board[1][1],board[1][2],board[1][3]);
sql3.Format("i8=%d and i9=%d and i10=%d and i11=%d and ",board[2][0],board[2][1],board[2][2],board[2][3]);
sql4.Format("i12=%d and i13=%d and i14=%d and i15=%d ",board[3][0],board[3][1],board[3][2],board[3][3]);
sql+=sql1;
sql+=sql2;
sql+=sql3;
sql+=sql4;
try
{
rst->raw_Close();
rst->Open((_bstr_t)sql,conn.GetInterfacePtr(),adOpenDynamic, adLockPessimistic,adCmdText);
count=rst->GetRecordCount();
rst->Close();
rst->Open("select * from fifnum",conn.GetInterfacePtr(),adOpenStatic,adLockOptimistic,adCmdText);//打开就记录集
if(count>0)
return true;
else
return false;
}
catch(_com_error &e)
{
AfxMessageBox(e.ErrorMessage(),0,0);
}
}