#1 2014-05-27 06:25:36

畅雨
Member
Registered: 2013-10-24
Posts: 29

How can I build the params of ConnectionProperties.Execute() ?

My code:

var
vparam: array of Tvarrec;
...
// How can I  build vparam ? the value form anther array (string array )

ConnectionProperties.Execute(aSQL, vparam)
...

Last edited by 畅雨 (2014-05-27 06:26:16)

Offline

#2 2014-05-27 06:30:16

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: How can I build the params of ConnectionProperties.Execute() ?

You should not use TVarRec, but an array of const parameters.

You can't bind a parameter array, just an array of constant parameters.

Online

#3 2014-05-27 06:52:22

畅雨
Member
Registered: 2013-10-24
Posts: 29

Re: How can I build the params of ConnectionProperties.Execute() ?

sad    I do not know the number of parameters,Only know the number of parameters when running...  Need to dynamically create  parameters

Offline

#4 2014-05-27 07:05:22

ab
Administrator
From: France
Registered: 2010-06-21
Posts: 14,655
Website

Re: How can I build the params of ConnectionProperties.Execute() ?

You can try to define an array of TVarRec and set each value using VariantToVarRec() from SynCommons.pas.

But I'm afraid it won't work with SynDB classes, since TSQLDBStatement.Bind() does not support variant kind of parameters (yet)!
sad

The easiest is to bind all values one by one, using regular ISQLDBStatement.Bind() for each parameter.

Online

#5 2014-05-27 07:31:28

畅雨
Member
Registered: 2013-10-24
Posts: 29

Re: How can I build the params of ConnectionProperties.Execute() ?

thanks,

Offline

Board footer

Powered by FluxBB