Reputation: 5351
How to add parameters in TSmartQuery? I mean on the Parameter tab which can be seen when I click on params properties.
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.
Upvotes: 1
Views: 953
Reputation: 11040
TSmartQuery is component from ODAC library.
TSmartQuery is similar to other TQuery family you can use parameters in different ways depend on your needs:
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;
If you have an instance from TParam you can add to the qry like : Qry1.Params.AddParam(myParam).
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.
Upvotes: 2