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

user interface - Python attempting to create a simple gui, getting "AttributeError: 'MainMenu' object has no attribute 'intro_screen'" -

jquery - Common JavaScript snippet to share files on Google Drive, Dropbox, Box.net or SkyDrive -

Android Gson.fromJson error -