为什么不行啊?ADOQuery怎么用啊?
redrd 2003-11-05 09:21:31 用ADOQuery操作啊Access2000数据库,SQL写法有什么要求啊?我下面的写法老是说UPDATE语法错误???
String sSql;
try
{
sSql = "UPDATE [Study] SET (Title=:@Title,Keyword=:@Keyword,ClassID=:@ClassID,Date=:@Date) WHERE ID=:@ID";
frmMain->ADOQuery1->SQL->Clear();
frmMain->ADOQuery1->SQL->Add(sSql);
frmMain->ADOQuery1->Parameters->ParamByName("@Title")->Value = sTitle;
frmMain->ADOQuery1->Parameters->ParamByName("@Keyword")->Value = sKeyword;
frmMain->ADOQuery1->Parameters->ParamByName("@ClassID")->Value = iClassID;
frmMain->ADOQuery1->Parameters->ParamByName("@Date")->Value = dDate;
frmMain->ADOQuery1->Parameters->ParamByName("@ID")->Value = m_iID;
frmMain->ADOQuery1->ExecSQL();
}
catch(Exception&E)
{
String sErrorInfo=(String)E.ClassName()+":\n"+E.Message+"\t";
MessageBox(Handle,sErrorInfo.c_str(),"写数据时出错",MB_ICONWARNING);
}