代码如下:
try
   WLDMQ.RC_CSInvoiceRecordQ.FieldByName('CSIRCount').AsInteger := strtoint64(trim(TREndNo.Text)) - strtoint64(trim(TRBeginNo.Text))+1        
except
   WLDMQ.RC_CSInvoiceRecordQ.FieldByName('CSIRCount').AsInteger := 0;
end;
-------------------
环境是:DELPHI 5 + MS SQL SERVER 7.0
字段CSIRCount 是numeric,18,default(0);
TREndNo.Text,TRBeginNo.Text是DBEDIT.对应字段EndNo,BeginNo.类型是Varchar:13.
问:
1、当TREndNo.Text,TRBeginNo.Text的位数超过10位时相减的结果就不对了。
奇怪啊?例如:20000000000 - 10000000000 = 1410065409。
如果解决?

解决方案 »

  1.   

    将AsInteger改为AsVariant,AsInteger将一个Int64转化为Int32了————————————————————————————————————
    宠辱不惊,看庭前花开花落,去留无意;毁誉由人,望天上云卷云舒,聚散任风。
    ————————————————————————————————————