刚刚学习delphi,要做一个删除功能,可以通过编译,但是运行时删除数据表中存在的信息时,出现错误提示:Project Project1_caizepeng042_04.exe raised_exception class EOleException with message '对象名'supplier_caizepeng042_04'无效.'.Process stopped.Use Step or Run to continue.代码如下:
procedure TForm3.Button3Click(Sender: TObject);
beginif edit9.text='' then
messagebox(form3.Handle,'该项不能为空','警告',mb_ok+mb_iconwarning)
else
begin
Adoquery1.Close;
adoquery1.SQL.clear;
Adoquery1.SQL.Text:='select 供应商号 from supplier_caizepeng042_04 where 供应商号='''+edit9.text+'''';
adoquery1.Open;
if adoquery1.FieldByName('供应商号').AsString<>'' then
begin
Adoquery1.Close;
Adoquery1.SQL.Clear;
Adoquery1.SQL.Add('delete from supplier_caizepeng402_04 where 供应商号='''+edit9.text+'''');
Adoquery1.ExecSQL;
end
else
begin
messagebox(form3.Handle,'该供应商不存在','警告',mb_ok+mb_iconwarning);
end;
end;
adoquery1.Close;
adoquery1.SQL.clear;
adoquery1.SQL.Add('select * from supplier_caizepeng042_04');
adoquery1.open;
end;
end.
找了很久也搞不出问题在哪.
麻烦大家帮忙看一下