Foros Club Delphi

Foros Club Delphi (https://www.clubdelphi.com/foros/index.php)
-   Conexión con bases de datos (https://www.clubdelphi.com/foros/forumdisplay.php?f=2)
-   -   Findkey en ADO !!! (https://www.clubdelphi.com/foros/showthread.php?t=5611)

vpepen 27-11-2003 13:21:42

Findkey en ADO !!!
 
Hola Foro !!!

Por favor, me gustaría saber si existe una función en el componente ADOTable que sea similar al Findkey del componente Table. De ser así cuál sería el procedimiento de usarla?

Las gracias anticipadas,

Víctor.-

marcoszorrilla 27-11-2003 15:51:26

De la propia ayuda de Delphi:
Cita:

KeyValues is the value to search for or multiple values if the index is based on multiple fields.

ADODataSet1.Seek(VarArrayOf([90030, 90020]), soFirstEQ);

SeekOption specifies the type of comparison made in determining whether the search was successful. SeekOption can be one of the six constants:

Seek Option Meaning

soFirstEQ Record pointer positioned at the first matching record, if one is found, or at the end of the dataset if one is not found.
soLastEQ Record pointer positioned at the last matching record, if one is found, or at the end of the dataset if one is not found.
soAfterEQ Record pointer positioned at matching record, if found, or just after where that matching record would have been found.
soAfter Record pointer positioned just after where a matching record would have been found.

soBeforeEQ Record pointer positioned at matching record, if found, or just before where that matching record would have been found.
soBefore Record pointer positioned just before where a matching record would have been found.
Un Saludo.

vpepen 27-11-2003 16:23:36

If ADOTable2.Seek(ADOTable1Codigo.Value, soFirstEQ) = True Then
ShowMessage('El cliente ya existe !!!')
else
ADOTable1.Post;

Al ejecutar el código de arriba se produce el siguiente error:

'The operation requested by the application is not supported by the provider'

Cabanyaler 05-12-2003 11:14:18

Hola, aunque un tanto mas lento, pero tampoco tanto, puedes utilizar el metodo Locate.

P.e.

DM.ADOQuery_Nombre.Locate('NombreCampoDondeBusca',VariableConValorABuscar,[loCaseInsensitive]))

Suerte


La franja horaria es GMT +2. Ahora son las 04:30:04.

Powered by vBulletin® Version 3.6.8
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
Traducción al castellano por el equipo de moderadores del Club Delphi