关于FieldByName的问题。。delphi。。好心人瞅下
{-----------}varresultDS:string;resultDS:='select库存金额,库存数量,JQJFROMFromKuCunAllViewByI...
{-----------}
var
resultDS :string;
resultDS :='select 库存金额,库存数量,JQJ FROM FromKuCunAllViewByID '+
'(' +IntToStr(stock_type_sid) + ',''+ refund_num +'',''+ sale_sun +'')';
ZKPCRODM.GetUniQry(vUniQry);
ZKPCRODM.OpenUniQueryBySQL(vUniQry,resultDS);
if (resultDS.FieldByName('库存数量').AsFloat = 0) then
begin
dChengBenDJ := (resultDS.FieldByName('JQJ').AsFloat);
end;
else then
begin
dChengBenDJ := ((resultDS.FieldByName('库存金额').AsFloat)/
(resultDS.FieldByName('库存数量').AsFloat));
dTotalCheng := dChengBenDJ * (StrToInt(sale_sun));
dMaoLi := StrToInt(original_price) - dTotalCheng;
end;
这样写的话FieldByName会报错,也许是resultDS 的错,因为类型应该不对,但他又=sql语句。所以还得设成String。大家帮我瞅瞅,,怎么办啊。。谢谢 展开
var
resultDS :string;
resultDS :='select 库存金额,库存数量,JQJ FROM FromKuCunAllViewByID '+
'(' +IntToStr(stock_type_sid) + ',''+ refund_num +'',''+ sale_sun +'')';
ZKPCRODM.GetUniQry(vUniQry);
ZKPCRODM.OpenUniQueryBySQL(vUniQry,resultDS);
if (resultDS.FieldByName('库存数量').AsFloat = 0) then
begin
dChengBenDJ := (resultDS.FieldByName('JQJ').AsFloat);
end;
else then
begin
dChengBenDJ := ((resultDS.FieldByName('库存金额').AsFloat)/
(resultDS.FieldByName('库存数量').AsFloat));
dTotalCheng := dChengBenDJ * (StrToInt(sale_sun));
dMaoLi := StrToInt(original_price) - dTotalCheng;
end;
这样写的话FieldByName会报错,也许是resultDS 的错,因为类型应该不对,但他又=sql语句。所以还得设成String。大家帮我瞅瞅,,怎么办啊。。谢谢 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询