当前位置:数据库 > SQLServer >>

SQL server2005数据库 下面的代码可能存在什么语法错误?

代码: int CPageSjxx::Delalltemp() { CFgySystemDlg *pMainDlg=(CFgySystemDlg *)AfxGetApp()->GetMainWnd(); CString sql=_T("select * from ReagentInfo"); CADOCommand *pcmd=new CADOCommand(&pMainDlg->m_pDb,sql,1); if (pMainDlg->m_pRs.Execute(pcmd)) { if (!pMainDlg->m_pRs.IsBof()) { CString sql=""; //sql ="delete * from ReagentInfo"; sql.Format("delete * from ReagentInfo where PAN_POINT=%d and REAGENT_TYPE=%d",nRow,iSelectPan); CADOCommand *pDel=new CADOCommand(&pMainDlg->m_pDb,sql,1); pMainDlg->m_pRs.Execute(pDel); } } UpdateData(); //this->UpdateReagentStock(iSelectPan,nRow-1,0); return 1; } 运行出现下面的提示错误: CADORecordset Error code = 8004oe14 code meaning = IDispatch error #3092 source = Microsoft OLE DB Provider for ODBC Drivers Discription = [Microsoft][ODBC Microsoft Access Driver] ’ * ‘ 语法错误
答案:sql.Format("delete * from ReagentInfo where PAN_POINT=%d and REAGENT_TYPE=%d",nRow,iSelectPan);
 
 
去掉 * ,改为 
 
sql.Format("delete from ReagentInfo where PAN_POINT=%d and REAGENT_TYPE=%d",nRow,iSelectPan);
 
试试
其他:没有看见调用数据库的语句,提示上应该是数据库连接有问题。

上一个:SQL SERVER 被攻击
下一个:谁有SQL server 2008 的电子版教程 能发给我吗 535769465@qq.com 谢谢~

CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,