Interbase时间戳列

时间:2017-11-08 17:19:13

标签: delphi firedac interbase

我在打开使用timestamp参数到interbase表的查询时遇到问题。检查stackoverflow并实现MapRules的转换映射后,我得到"不支持转换"打开查询时。

非常感谢任何帮助,谢谢!

以下是设置参数的代码:



    with FDQuery1 do
    begin
      Close;
      FDQuery1.FormatOptions.OwnMapRules := True;
      with FormatOptions.MapRules.Add do
      begin
        SourceDataType := dtDateTime;
        TargetDataType := dtDateTimeStamp;
      end;
      FDQuery1.Params.ParamByName('BalanceDate').AsDateTime := StrToDateTime('10/03/2017');
      FDQuery1.ParamByName('User').AsInteger := 1;
      FDQuery1.OpenOrExecute;
    end;




以下是查询:



SELECT
 AC.ACCOUNT_ID,
 AC.ACCOUNT_NAME,
 ACT.ACCOUNT_TYPE_NAME,
 (Select Sum(P1.TOTAL_VAL) From PMNTDOCTRANS P1, DAYBATCH D1 Where
  (P1.ACCOUNT_ID=AC.ACCOUNT_ID)
  And (D1.DAY_BATCH_ID=P1.DAY_BATCH_ID)
  And (D1.DAY_BATCH_DATE <= :BalanceDate)
  And (D1.DAY_BATCH_STORE in (Select Id From ExtUserList Where List_Id=9 and User_Id =:User))
 ) As Val1,
 (Select Sum(P2.TOTAL_VAL) From PMNTDOCTRANS P2, DAYBATCH D2 Where
  (P2.OPOSIT_ACCOUNT=AC.ACCOUNT_ID)
  And (D2.DAY_BATCH_ID=P2.DAY_BATCH_ID)
  And (D2.DAY_BATCH_DATE <= :BalanceDate)
  And (D2.DAY_BATCH_STORE in (Select Id From ExtUserList Where List_Id=9 and User_Id =:User))
 ) As Val2
FROM
 ACCOUNT AC ,
 ACCOUNTTYPE ACT
WHERE
 (ACT.ACCOUNT_TYPE_ID = AC.ACCOUNT_TYPE_ID)
 And
 (AC.ACCOUNT_TYPE_ID in (Select Id From ExtUserList Where List_Id=3 and User_Id =:User))
ORDER BY ACCOUNT_TYPE_NAME
&#13;
&#13;
&#13;

1 个答案:

答案 0 :(得分:0)

这个问题可以这样解决

FDQuery1.Params.ParamByName('BalanceDate').Value:= StrToDateTime('10/03/2017');