D
desertfox007
Unregistered / Unconfirmed
GUEST, unregistred user!
{procedure TfmAR110.qyMasterUpdateRecord(DataSet: TDataSet;
//
UpdateKind: TUpdateKind;
var UpdateAction: TUpdateAction);
var
fOldAdvance, fNewAdvance : Extended;
fOldTotalBalance, fNewTotalBalance : Extended;
sCustomerID : String;
begin
inherited;
fNewAdvance := 0;
fOldAdvance := 0;
fNewTotalBalance := 0;
fOldTotalBalance := 0;
sCustomerID := '';
case UpdateKind of
ukInsert :
begin
fNewAdvance := DataSet.FieldByName('Advance').NewValue;
fOldAdvance := 0;
fNewTotalBalance := DataSet.FieldByName('TotalBalance').NewValue;
fOldTotalBalance := 0;
sCustomerID := DataSet.FieldByName('CustomerID').NewValue;
end;
ukModify :
begin
fNewAdvance := DataSet.FieldByName('Advance').NewValue;
fOldAdvance := DataSet.FieldByName('Advance').OldValue;
fNewTotalBalance := DataSet.FieldByName('TotalBalance').NewValue;
fOldTotalBalance := DataSet.FieldByName('TotalBalance').OldValue;
sCustomerID := DataSet.FieldByName('CustomerID').OldValue;
end;
ukDelete :
begin
fNewAdvance := DataSet.FieldByName('Advance').OldValue;
fOldAdvance := DataSet.FieldByName('Advance').OldValue;
fNewTotalBalance := DataSet.FieldByName('TotalBalance').OldValue;
fOldTotalBalance := DataSet.FieldByName('TotalBalance').OldValue;
sCustomerID := DataSet.FieldByName('CustomerID').OldValue;
end;
end;
with qyTempdo
begin
Close;
SQL.Clear;
SQL.Add('UPDATE CustomerMaster SET Advance = Advance + :Advance, ');
SQL.Add('CreditBalance = CreditBalance + :CreditBalance ');
SQL.Add('WHERE CompanyID = :CompanyID AND CustomerID = :CustomerID ');
ParamByName('CompanyID').AsString := sCompanyID;
ParamByName('CustomerID').AsString := sCustomerID;
ParamByName('Advance').AsFloat := fNewAdvance - fOldAdvance;
ParamByName('CreditBalance').AsFloat := fNewTotalBalance - fOldTotalBalance;
ExecSQL;
end;
end;
}
上面的是BDE写的,我想把它高造成ADO的 请问一下有什么方法?
//
UpdateKind: TUpdateKind;
var UpdateAction: TUpdateAction);
var
fOldAdvance, fNewAdvance : Extended;
fOldTotalBalance, fNewTotalBalance : Extended;
sCustomerID : String;
begin
inherited;
fNewAdvance := 0;
fOldAdvance := 0;
fNewTotalBalance := 0;
fOldTotalBalance := 0;
sCustomerID := '';
case UpdateKind of
ukInsert :
begin
fNewAdvance := DataSet.FieldByName('Advance').NewValue;
fOldAdvance := 0;
fNewTotalBalance := DataSet.FieldByName('TotalBalance').NewValue;
fOldTotalBalance := 0;
sCustomerID := DataSet.FieldByName('CustomerID').NewValue;
end;
ukModify :
begin
fNewAdvance := DataSet.FieldByName('Advance').NewValue;
fOldAdvance := DataSet.FieldByName('Advance').OldValue;
fNewTotalBalance := DataSet.FieldByName('TotalBalance').NewValue;
fOldTotalBalance := DataSet.FieldByName('TotalBalance').OldValue;
sCustomerID := DataSet.FieldByName('CustomerID').OldValue;
end;
ukDelete :
begin
fNewAdvance := DataSet.FieldByName('Advance').OldValue;
fOldAdvance := DataSet.FieldByName('Advance').OldValue;
fNewTotalBalance := DataSet.FieldByName('TotalBalance').OldValue;
fOldTotalBalance := DataSet.FieldByName('TotalBalance').OldValue;
sCustomerID := DataSet.FieldByName('CustomerID').OldValue;
end;
end;
with qyTempdo
begin
Close;
SQL.Clear;
SQL.Add('UPDATE CustomerMaster SET Advance = Advance + :Advance, ');
SQL.Add('CreditBalance = CreditBalance + :CreditBalance ');
SQL.Add('WHERE CompanyID = :CompanyID AND CustomerID = :CustomerID ');
ParamByName('CompanyID').AsString := sCompanyID;
ParamByName('CustomerID').AsString := sCustomerID;
ParamByName('Advance').AsFloat := fNewAdvance - fOldAdvance;
ParamByName('CreditBalance').AsFloat := fNewTotalBalance - fOldTotalBalance;
ExecSQL;
end;
end;
}
上面的是BDE写的,我想把它高造成ADO的 请问一下有什么方法?