程序编译没问题,但在运行过程中,点击添加记录时(响应OnInputenter()函数),提示:“查询值数目与目标字段中的数目不同。” 点击确定后还出现“IDispatch error #3092"即“表已存在。” 部分代码如下: void CInputDialog::OnInputenter()
{
// TODO: Add your control notification handler code here
UpdateData();
try
{
CString sql;
sql.Format("INSERT INTO info(中文,英文) VALUES('%s','%s')",m_zhongwen,m_yingwen);
pConn->Execute((_bstr_t)sql,NULL,adCmdText);
}
catch(const _com_error e)
{
AfxMessageBox(e.Description());
long errorCode=e.WCode();
if(3127==errorCode) AfxMessageBox("表不存在");
if(3092==errorCode) AfxMessageBox("表已经存在");
return;
} } access数据库中,info表名,依次有三个字段:编号(自动编号)、中文(文本)、英文(文本); 希望各位大哥帮忙想个解决的办法。
{
// TODO: Add your control notification handler code here
UpdateData();
try
{
CString sql;
sql.Format("INSERT INTO info(中文,英文) VALUES('%s','%s')",m_zhongwen,m_yingwen);
pConn->Execute((_bstr_t)sql,NULL,adCmdText);
}
catch(const _com_error e)
{
AfxMessageBox(e.Description());
long errorCode=e.WCode();
if(3127==errorCode) AfxMessageBox("表不存在");
if(3092==errorCode) AfxMessageBox("表已经存在");
return;
} } access数据库中,info表名,依次有三个字段:编号(自动编号)、中文(文本)、英文(文本); 希望各位大哥帮忙想个解决的办法。
"INSERT INTO info(中文,英文) VALUES('%s','%s')"中文 和 英文 之间的逗号有问题。