下面这段代码编译通过,运行时出现错误Idispatch error #3092,是什么原因?
void CRsCgDlg4::OnBtnjudge() 
{
UpdateData();
// TODO: Add your control notification handler code here
//method one
     CString  str1=m_strDlgselansewer;
 CString  str2=m_strDlganswer;
if(str1.Compare(str2)!=0)
{
 CString sql_;
 sql_.Format("UPDATE TestResult_VIEW SET rusult='错' where quno='%s'",m_strDlgquno);
 _bstr_t strSQL=sql_;
 try
{
m_DBCnt->Execute(strSQL,NULL,adCmdText);
}
 catch(_com_error& e)
{
   AfxMessageBox(e.ErrorMessage());
return;
}
RefreshBoundData();
}
 else
{
   rightnumber++;
   CString sql_;
   sql_.Format("UPDATE TestResult_VIEW SET rusult='对' where quno='%s'",m_strDlgquno);
   _bstr_t strSQL=sql_;
  try
  {
m_DBCnt->Execute(strSQL,NULL,adCmdText);
  }
  catch(_com_error& e)
  {
AfxMessageBox(e.ErrorMessage());
return;
  }         RefreshBoundData();
 }
 UpdateWindow();
}
  其中m_strDlgselansewer和m_strDlganswer是视图TestResult_VIEW中的对应字段(字符型)在对话框中的变量,这段代码我想将这两个字段的内容进行比较,并把比较之后所得结果放在视图中对应的字段result中,m_DBCnt 为连接指针,其初始化代码如下:m_DBCnt.CreateInstance(__uuidof(Connection));
CString sql_;
sql_.Format("DSN=ConKnow;UID=sa;PWD= ");
_bstr_t sql=sql_;
m_DBCnt->Open(sql," "," ",-1);

解决方案 »

  1.   

    '错'  'F‘
    '对'‘T'DWORD dw=GetLastError() 
      

  2.   

    一般是SQL语句出错,你把sql_的内容放到数据库中看能不能执行
      

  3.   

    这是MSDN上面对这个问题的解释,你可以照这里说的,去下载最新的
    Commerce Server 2000 Service Pack
    来安装看能不能解决问题:SYMPTOMS
    When you import a catalog in a Data Warehouse Data Transformation Services (DTS) task, you may receive the following error message: 
    Error -2147217900 Msg: Idispatch error #3092 Description: There is already an object named '#CatTmp' in the database 
    CAUSE
    When you import the catalog, the dynamic Structured Query Language (SQL) in the dynamic-link library (DLL) creates a temporary table named #CatTmp, but does not detect the catalog and does not drop the catalog correctly for later use if the user is not a Database Owner (DBO). 
    RESOLUTION
    To resolve this problem, obtain the latest service pack for Commerce Server 2000. For additional information, click the following article number to view the article in the Microsoft Knowledge Base: 
    297216 INFO: How to Obtain the Latest Commerce Server 2000 Service Pack The English version of this fix should have the following file attributes or later:   Date         Time   Size   File name    
       ----------------------------------------
       16-Apr-2002  15:40  525KB  Cdtstasks.dll  

    STATUS
    Microsoft has confirmed that this is a problem in Microsoft Commerce Server 2000. This problem was first corrected in Commerce Server 2000 Service Pack 3 (SP3).
      

  4.   

    1, 可能是数据库不支持你的sql语法
    2, 要更新的字段不能被更新