我有以下代码用于更新数据库中的表,此代码用于使用 zeosdblib 查询组件在 bds 2006 中工作,但现在它在 delphi xe2 中不起作用。谁能告诉我我哪里出错了。谢谢你
procedure TGoodsReceivedForm.btnCategorizeClick(Sender: TObject);
var
TempCatTotal : Extended;
nCatogory : string;
begin
TempCatTotal := 0;
zroqryExpcat.Open;
with zroqryExpcat do
begin
first;
while not Eof do
begin
zqrySumCategory.Close;
zqrySumCategory.SQL.Clear;
zqrySumCategory.SQL.Add('select costcategory,packcost,sum(qty)*packcost as pamount');
zqrySumCategory.SQL.Add('from pitems');
zqrySumCategory.SQL.Add('where costcategory=:costcategory and orderno=:orderno');
zqrySumCategory.SQL.Add('group by costcategory,packcost');
zqrySumCategory.Params[0].AsString := zroqryExpcat.FieldByName('Description').Value;
zqrySumCategory.Params[1].AsString := NewPurchaseOrderForm.OrderNumber.Caption ;
zqrySumCategory.Open;
zqrySumCategory.First;
TempCatTotal := 0;
while not zqrySumCategory.eof do
begin
TempCatTotal := TempCatTotal+zqrySumCategory.FieldByName('pamount').AsFloat;
zqrySumCategory.Next;
end;
if TempCatTotal > 0 then
begin
zqryInsertExpense.Close;
zqryInsertExpense.Params[0].AsString := NewPurchaseOrderForm.OrderNumber.Caption ;
zqryInsertExpense.Params[1].AsString := zqrySumCategory.Params[0].AsString ;
zqryInsertExpense.Params[2].AsCurrency := TempCatTotal;
zqryInsertExpense.Params[3].Asinteger := zroqryExpcat.FieldByName('gl_account_no').Value;
zqryInsertExpense.Params[4].AsDate := ReceivedDate.Date;
zqryInsertExpense.ExecSQL;
zqryInsertExpense.Close;
end;
next;
end;
end;
zqryListExpenseCat.Close;
zqryListExpenseCat.Params[0].Value := NewPurchaseOrderForm.OrderNumber.Caption;
zqryListExpenseCat.Open;
end;