D
Danseuse
Unregistered / Unconfirmed
GUEST, unregistred user!
数据库DB.dbf的字段有:A1,A2,A3,A4,A5,A6
主要元件有DataSource1,DBGrid1,Query1,Query2,Button1
元件Query1用于查询记录
元件Query2用于删除记录,SQL语句为:
Delete From DB.dbf Where A1 = :A1 and A2 = :A2 and A3 = :A3
DataSource1.DateSet = Query1
DBGrid1.DataSource = DataSource1
按钮Button1用于删除记录
procedure TForm1.Button1Click(Sender: TObject);
begin
with Query2 do
begin
ParamByName('A1').Value := Query1.FieldValues['A1'];
ParamByName('A2').Value := Query1.FieldValues['A2'];
ParamByName('A3').Value := Query1.FieldValues['A3'];
ExecSQL;
end;
end;
当前记录的A1、A2、A3都不为空时,按按钮Button1时,能删除当前记录;
当前记录的A1或A2或A3为空时,按按钮Button1时,不能删除当前记录,
这时该如何用SQL语句删除当前记录?
主要元件有DataSource1,DBGrid1,Query1,Query2,Button1
元件Query1用于查询记录
元件Query2用于删除记录,SQL语句为:
Delete From DB.dbf Where A1 = :A1 and A2 = :A2 and A3 = :A3
DataSource1.DateSet = Query1
DBGrid1.DataSource = DataSource1
按钮Button1用于删除记录
procedure TForm1.Button1Click(Sender: TObject);
begin
with Query2 do
begin
ParamByName('A1').Value := Query1.FieldValues['A1'];
ParamByName('A2').Value := Query1.FieldValues['A2'];
ParamByName('A3').Value := Query1.FieldValues['A3'];
ExecSQL;
end;
end;
当前记录的A1、A2、A3都不为空时,按按钮Button1时,能删除当前记录;
当前记录的A1或A2或A3为空时,按按钮Button1时,不能删除当前记录,
这时该如何用SQL语句删除当前记录?