CString str1=_T("说明");
CString str2=_T("说明");
CString str3=_T("说明");
CString str4=_T("说明");
CString str5=_T("说明");
CString str6=_T("说明");
_variant_t recodsaffected;
CString strSQL;
strSQL.Format("INSERT INTO yinpian6(worker6,state6,suntitle6,benshu6,jihao6,time6) VALUES('%s','%s','%s','%s','%s','%s')",str1,str2,str3,str4,str5,str6);
m_pConnection->Execute((_bstr_t)strSQL,&recodsaffected,adCmdText);
yinpian6(worker6,state6,suntitle6,benshu6,jihao6,time6) VALUES('%s','%s','%s','%s','%s','%s')",str1,str2,str3,str4,str5,str6);
这个是我在D盘的建立的一个ACCESS表格的字段worker6,state6,suntitle6,benshu6,jihao6,time6,都是文本型,不知道问什么失败啊。。。
运行就是rutime error。。。
恳请大侠帮忙啊。。。
MessageBox("恭喜你加入信息");
C/C++ code:
try{ //sql操作}
catch(_com_error e)
{
CString strComError;
strComError.Format("错误编号: %08lx\n错误信息: %s\n错误源: %s\n错误描述: %s",
e.Error(), // 错误编号
e.ErrorMessage(), // 错误信息
(LPCSTR) e.Source(), // 错误源
(LPCSTR) e.Description()); // 错误描述
::MessageBox(NULL,strComError,"错误",MB_ICONE
vc中用odbc的方法访问access数据库,用到了cdatabase类和crecordset类。数据源在窗口初始化的时候被打开g_datasource.Open("data",FALSE,FALSE); 点击一个按钮启动一个定时器,在定时器内完成以下操作,定 ......