ADOQuery出错问题,谁遇到过?
void __fastcall TForm1::Button1Click(TObject *Sender)
{
AnsiString SqlStr;
SqlStr=" update ftXs set dwB='22222' ";
SqlStr+=" where number1='03-001' ";
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add(SqlStr);
ADOQuery1->ExecSQL(); //
}
//---------------------------------------------------------------------------
void __fastcall TForm1::FormCreate(TObject *Sender)
{
ADOQuery1->Close();
ADOQuery1->SQL->Add("select * from ftxs ");
ADOQuery1->Open();
ADOQuery1->Close();
}
//---------------------------------------------------------------------------
执行Click事件之后提示出错
"Accessviolation at address 1F487CAB in module 'msado15.dll'. write of
address 01720004"
如果把FormCreat事件里面的代码改成
AnsiString SqlStr;
SqlStr=" update ftXs set dwB=45345";
SqlStr+=" where number1='03-001' ";
ADOQuery1->Close();
ADOQuery1->SQL->Clear();
ADOQuery1->SQL->Add(SqlStr);
ADOQuery1->ExecSQL(); //
则可以顺利执行,但是Click事件代码可以执行,但是数据库的数据没有更新
在线等待