IDispatch error #3092

huiqq0016 2009-03-17 01:37:33
我程序代码如下发生了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);
}
}
...全文
392 5 打赏 收藏 转发到动态 举报
写回复
用AI写文章
5 条回复
切换为时间正序
请发表友善的回复…
发表回复
whjwo 2011-08-09
  • 打赏
  • 举报
回复
我将关键字加了[],但是多表查询时,有2个表还是出现这个问题。
a469367940 2009-11-20
  • 打赏
  • 举报
回复
确定以及肯定是字符冲突了,你的数据库里设置了关键字,肯定是你加入的内容和表里面的内容相同,发生关键字重复的错误,我出现了很多次了
a469367940 2009-11-18
  • 打赏
  • 举报
回复
确定是字符的问题吗?我今天下午也碰到了同样的问题,不过我检查了半天,没有字符冲突啊!
S_S_Ge 2009-07-18
  • 打赏
  • 举报
回复
我也遇到IDispatch error #3092问题
是关键字的问题
不过楼主一分都不给?呵呵
TianChong 2009-03-20
  • 打赏
  • 举报
回复
是不是没有初始化COM环境啊?看出错是和COM相关的,要使用ADO一定要先初始化COM环境:
::CoInitialize(NULL);

另外,建议楼主重新注册一个帐号,这样才有分给大家,你没分很多人可能不愿来看你的问题的。

4,012

社区成员

发帖
与我相关
我的任务
社区描述
VC/MFC 数据库
社区管理员
  • 数据库
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧