Home > Back-end >  Delphi dbgird calculation problem! Pray god help!
Delphi dbgird calculation problem! Pray god help!

Time:11-10







\ \ -- -- -- -- -- -- -- -- -- -- -- -- -- -- middle loop not now, so tired -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
The begin
Inherited;
With adoquery1 do
The begin
First;
While not Eof do
The begin
Edit;
FieldByName (' complete number). AsInteger:=StrToIntDef (FieldByName (' Y501). AsString, 0) +
StrToIntDef (FieldByName (' Y502). AsString, 0) +
StrToIntDef (FieldByName (' Y503). AsString, 0) +
StrToIntDef (FieldByName (' Y504). AsString, 0).
FieldByName (' unfinished '). AsInteger:=StrToIntDef (FieldByName (' orders'). AsString, 0) - StrToIntDef (FieldByName (' complete number). AsString, 0).
Next;
end;
First;
end;
\ \ -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
Please help!

CodePudding user response:

On May 1, the main problem is Y501 represents in June, July? I will be tired to climb!
Beg you instruct me greatly!

CodePudding user response:

Why not use SQL to calculate good return to Delphi show?

CodePudding user response:

While not Eof do
The begin
Try
Edit;
FieldByName (' complete number). AsInteger:=StrToIntDef (FieldByName (' Y501). AsString, 0) +
StrToIntDef (FieldByName (' Y502). AsString, 0) +
StrToIntDef (FieldByName (' Y503). AsString, 0) +
StrToIntDef (FieldByName (' Y504). AsString, 0).
FieldByName (' unfinished '). AsInteger:=StrToIntDef (FieldByName (' orders'). AsString, 0) - StrToIntDef (FieldByName (' complete number). AsString, 0).
Next;
Except on e: the Exception do

ShowMessage (e.M essage);

end;//try

end;//while not Eof do



//////because your family have a few columns allow is empty, empty character is not positive for D
  • Related