c++ - Call TDataSet.Locate in one line -


in rad studio wiki can find documentation on using tdataset.locate method.

following c++ snippet comes there:

tlocateoptions opts; opts.clear(); opts << lopartialkey; variant locvalues[2]; locvalues[0] = variant("sight diver"); locvalues[1] = variant("p"); custtable->locate("company;contact", vararrayof(locvalues, 1), opts); 

i'd call locate all in 1 line, can in delphi. or simpler:

custtable->locate("company;contact", vararrayof(new variant[2]{variant("sight diver"), variant("p")}, 1), tlocateoptions() << lopartialkey ); 

compiler says e2121 function call missing ).

is possible?

according comments, problem second parameter, , open array vararrayof receives.

according documentation, openarray macro helpful. you'd call vararrayof this:

vararrayof(openarray(variant, ("sight diver", "p"))) 

so call locate become:

custtable->locate("company;contact",                    vararrayof(openarray(variant, ("sight diver", "p"))),                    tlocateoptions() << lopartialkey ); 

Comments

Popular posts from this blog

blackberry 10 - how to add multiple markers on the google map just by url? -

php - guestbook returning database data to flash -

delphi - Dynamic file type icon -