Delphi - Todo sobre locate

 
Vista:

Todo sobre locate

Publicado por Pollux (27 intervenciones) el 20/05/2008 17:25:01
Hola a todos:
Necesito saber todo acerca de la funcion "Locate", yo trabajo solo lo básico con ella pero sé que tiene muchas opciones que permiten un mejor manejo de busquedas.
Espero me ayuden en esto.
Gracais y suerte.
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:Todo sobre locate

Publicado por Eva (484 intervenciones) el 23/05/2008 00:26:52
Pones en delphi la palabra locate y pulsas F1 y sale esto y otras muchas cosas más. Empieza por esto y si te van surgiendo dudas pregunta cosas puntuales.

Searches the dataset for a specified record and makes that record the current record.

Delphi syntax:

function Locate(const KeyFields: String; const KeyValues: Variant; Options: TLocateOptions
): Boolean;

C++ syntax:

virtual bool __fastcall Locate(const AnsiString KeyFields, const System::Variant &KeyValues, Db::TLocateOptions Options);

Description

Call Locate to search a dataset for a specific record and position the cursor on it.

KeyFields is a string containing a semicolon-delimited list of field names on which to search.

KeyValues is a variant array containing the values to match in the key fields. If KeyFields lists a single field, KeyValues specifies the value for that field on the desired record. To specify multiple search values, pass a variant array as KeyValues, or construct a variant array on the fly using the VarArrayOf routine. For example:

with CustTable do
Locate('Company;Contact;Phone', VarArrayOf(['Sight Diver', 'P', '408-431-1000']), [loPartialKey]);
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);

Options is a set that optionally specifies additional search latitude when searching on string fields. If Options contains the loCaseInsensitive setting, then Locate ignores case when matching fields. If Options contains the loPartialKey setting, then Locate allows partial-string matching on strings in KeyValues. If Options is an empty set, or if the KeyFields property does not include any string fields, Options is ignored.

Locate returns true if it finds a matching record, and makes that record the current one. Otherwise Locate returns false.

Locate uses the fastest possible method to locate matching records. If the search fields in KeyFields are indexed and the index is compatible with the specified search options, Locate uses the index. Otherwise Locate creates a filter for the search.


Implements a virtual method for searching a dataset for a specified record and making it the active record.

Delphi syntax:

function Locate(const KeyFields: string; const KeyValues: Variant; Options: TLocateOptions
): Boolean; override;

C++ syntax:

virtual bool __fastcall Locate(const AnsiString KeyFields, const Variant &KeyValues, DB::
TLocateOptions Options);

Description

This function:

Checks whether the dataset is unidirectional, and if so, raises an EDatabaseError exception.
Returns false, indicating that a matching record was not found and the active record was not changed.

Descendant classes that are not unidirectional override this method so that it locates the record where the fields identified by the semicolon-separated list of fields in KeyFields have the values specified by the Variant or Variant array KeyValues. Options indicates whether the search is case insensitive and whether partial matches are supported. Locate returns true if a record is found that matches the specified criteria and that record is now active.
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar

RE:Todo sobre locate

Publicado por Claudio (1 intervención) el 21/10/2008 00:49:45
hola necesito saber cuales son las palabras reservas de delphi
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar