我的要求還要復雜﹐我要求如果該值為空﹐還要新增﹐我是在query的onupdaterecord中
寫﹕(我的程式的一段)
procedure TF_w_cpxb1.q_cpxb_dessUpdateRecord(DataSet: TDataSet;
UpdateKind: TUpdateKind; var UpdateAction: TUpdateAction);
begin
q_cpxb_dess.UpdateObject:=usql_cpxb_dess;
usql_cpxb_dess.setparams(updatekind);
if (q_cpxb_dess.fieldbyname('pin_qty').oldvalue=null)and (q_cpxb_dess.fieldbyname('pin_qty').newvalue<>null)then
begin
usql_cpxb_dess.setparams(ukInsert);
usql_cpxb_dess.ExecSQL(ukInsert);
updateAction:=uaApplied;
end ;
if (q_cpxb_dess.fieldbyname('pin_qty').oldvalue<>null) and (q_cpxb_dess.fieldbyname('pin_qty').newvalue=null)then
begin
usql_cpxb_dess.setparams(ukDelete);
usql_cpxb_dess.ExecSQL(ukDelete);
updateAction:=uaApplied;
end ;
if (q_cpxb_dess.fieldbyname('pin_qty').oldvalue<>null) and (q_cpxb_dess.fieldbyname('pin_qty').newvalue<>null)then
begin
usql_cpxb_dess.setparams(ukModify);
usql_cpxb_dess.ExecSQL(ukModify);
updateAction:=uaApplied;
end;
end;