Delphi使用带参数错误的sql

时间:2015-02-20 16:19:05

标签: sql-server delphi

我有以下代码;

  Dm.QrTmp.SQL.Add('(Select sum (sth.sth_tutar+sth.sth_vergi) from    
  '+MikActiveDb+'STOK_HAREKETLERI sth ');
  Dm.QrTmp.SQL.Add('where (sth.sth_tarih>= :ptar1 and sth.sth_tarih<= :ptar2)  ');

我设置了这样的参数。

  Dm.QrTmp.Parameters.ParamByName('ptar1').DataType := ftDate;
  Dm.QrTmp.Parameters.ParamByName('ptar2').DataType := ftDate;
  Dm.QrTmp.Parameters.ParamByName('ptar1').Value := Tarih1.Value;
  Dm.QrTmp.Parameters.ParamByName('ptar2').Value := Tarih2.Value;

但是在运行时delphi给我一个错误;

Parameter object is improperly defined. Inconsistent or incomplete information was provided.

0 个答案:

没有答案