代码:
CString CommandText = "INSERT INTO aver(prefix,date,weight,persugar,sugar) VALUES('gg','2007-2-13',1,0.32,0.32)";
_variant_t RecordsAffected;
try
{
m_pRecordset = theApp.m_pConnection->Execute(_bstr_t(CommandText),&RecordsAffected,adCmdText);
}
catch (_com_error *e) 
{
AfxMessageBox(e->ErrorMessage());
}用PutCollect插入在Update时又出错!
调试:
在m_pRecordset = theApp.m_pConnection->Execute(_bstr_t(CommandText),&RecordsAffected,adCmdText);
报如下错误:
Unhandled exception in Sugar.exe (KERNEL32.DLL): 0xE06D7363: Microsoft C++ Exception.

解决方案 »

  1.   

    检查 m_pConnection, m_pRecordset是否初始化。
      

  2.   

    INSERT INTO aver(prefix,[date],weight,persugar,sugar) VALUES('gg','2007-2-13',1,0.32,0.32);
      

  3.   

    INSERT INTO [aver]([prefix],[date],[weight],[persugar],[sugar]) VALUES('gg','2007-2-13',1,0.32,0.32);
      

  4.   

    INSERT INTO [aver]([prefix],[date],[weight],[persugar],[sugar]) VALUES('gg','2007-2-13',1,0.32,0.32);检查语句中
    是否 有 类型 和 数据库里面的类型 不 匹配.
      

  5.   

    prefix ,date是文本类型,weight,persugar,sugar是双精度类型
      

  6.   

    date,user,time,还有一些函数都是保留词,如果你的表名或者字段名与之冲突,可以加中括号把保留词转为字段引用,为了保险,全加上也不会有错误