How to search a dataset and position cursor on it

Discussion of open issues, suggestions and bugs regarding UniDAC (Universal Data Access Components) for Delphi, C++Builder, Lazarus (and FPC)
Post Reply
Ute
Posts: 2
Joined: Fri 27 Nov 2009 10:40

How to search a dataset and position cursor on it

Post by Ute » Tue 16 Nov 2010 09:36

I use the UniDac Componetnt with C++ Builder 2010.

In my program I use a TUniTable and I want to place the cursor on a specified dataset in the table. Therfore I want to use the Locate method.
The help of C++ Builder shows me the following Parameters for the Locate Method:

Locate(const UnicodeString, const Variant &, TLocateExOptions)

I have problems with the second parameter const Variant &

The Variant parameter in my application is a String. I don't know how I have to use ist. Everything I try gives me errormessages of the Compiler, which tells me that the parameter has the wrong type. Can you please give me an example how I can use the function with C++ Builder. All the examples I can find are for Delphi

Thank you very much

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 16 Nov 2010 10:42

Hello,

For example, you have a string field 'NAME', and to move to a record using this field you should use the following code:

TLocateOptions SrOpt;
SrOpt Locate("NAME",Edit1->Text,SrOpt);

where Edit1->Text is the text to search for.

Ute
Posts: 2
Joined: Fri 27 Nov 2009 10:40

Post by Ute » Tue 16 Nov 2010 14:06

It works fine, Thank you very much

regards Ute

AlexP
Devart Team
Posts: 5530
Joined: Tue 10 Aug 2010 11:35

Post by AlexP » Tue 16 Nov 2010 14:21

Hello,

It is good to see that this problem was solved. If any other questions come up, please contact me.

Post Reply