开发者

how to add parameters in TSmartQuery in IntraWeb?

How to add parameters in TSmartQuery? I mean on the Parameter tab which can be seen when I click on params properties.

开发者_如何学Go

I found two ways: -editing the dfm file -parameters are filled out automatically based on used :vars in Sql tab. I did not managed to add them manually using a user interface.


TSmartQuery is component from ODAC library.

TSmartQuery is similar to other TQuery family you can use parameters in different ways depend on your needs:

  1. If you already used Sql with parameters such as: Qry1.Sql.Text := 'Select * from Table where Id = :id'; then you can the defined parameter values as : Qry1.ParamByName('Id').asInteger := 10;

  2. If you have an instance from TParam you can add to the qry like : Qry1.Params.AddParam(myParam).

  3. You can create Parameter and assigned directly to the ParamList with : Qry1.Params.CreateParam();

which defined as:

function CreateParam(FldType: TFieldType; const ParamName: _string;
  ParamType: TParamType): TDAParam;

2 & 3 mostly used with Stored Procedures because you need to define if the parameter will be input or output param.

Update: I didn't notice that you are using Intraweb when I post my answer, but it should be the same way as you do with normal Delphi applications.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜