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)
-   -   Busqueda en tttable (https://www.clubdelphi.com/foros/showthread.php?t=26839)

fefe13 04-11-2005 21:59:43

Busqueda en tttable
 
USO ESTE CODIGO PARA BUSCAR REGISTROS EN MI TABLA,PERO SI HAY 2 DATOS QUE SE REPITEN SOLO MUESTRA EL PRIMERO,COMO PUEDO CAMBIARLO PARA QUE AL DARLE AL BOTON DE BUSCAR OTRA VEZ PASE AL SIGUIENTE,SI HAY VARIOS CON EL MISMO PARAMETRO?GRACIAS POR CONTESTAR
var
criteriobusqueda:tlocateoptions;
buscarbien:boolean;

cont:integer;
num:string;
begin
criteriobusqueda:=[lopartialkey];

buscarbien:=table1.locate(combobox1.items[combobox1.itemindex],edit1.text,criteriobusqueda);

Migpal 04-11-2005 22:05:18

Con el ttable no es posiblehacer eso hasta donde yo se, el cursor se ubica en el primero que encuentra, si quieres hayar mas, entonces te sugeriria:

tabla.first

while not tabla.eof do
begin
if tabla.locate... then agregaraunalista(registro);
tabla.next;
end;

con esto tiene en una lista los registros repetidos.

fefe13 04-11-2005 22:09:46

Buscar en tttable
 
Vale gracias por tu respuesta pero que significa"AGREGAR UNA LISTA Y REGISTRO"

Migpal 04-11-2005 22:22:43

Una lista encadenada, Tlist puede ser, sirve para guardar estructuras de datos, entonces

milista:Tlist;

milista.clear;
milista.add(apuntador de la estructura que guarda el registro de la tabla);

hay quedan entonces todos los registros repetidos.

fefe13 04-11-2005 22:33:39

busqueda ttable
 
el problema es que no me aparece el tlist,yo tengo el delphi 7,no se si sera por eso

vtdeleon 05-11-2005 02:35:37

Saludos
Cita:

Empezado por fefe13
USO ESTE CODIGO PARA BUSCAR REGISTROS EN MI TABLA,PERO SI HAY 2 DATOS QUE SE REPITEN SOLO MUESTRA EL PRIMERO,COMO PUEDO CAMBIARLO PARA QUE AL DARLE AL BOTON DE BUSCAR OTRA VEZ PASE AL SIGUIENTE,SI HAY VARIOS CON EL MISMO PARAMETRO?

Respondiendo el 1er post, podrias usar LocateNext
Cita:

Empezado por Ayuda Delphi
Searches the dataset for the record after a specified record and makes that record the current record.
...
Call LocateNext to search a dataset for a record after the current cursor position


Delfino 05-11-2005 11:15:10

Cita:

Respondiendo el 1er post, podrias usar LocateNext
Si no me equivoco LocateNext existe solo para los IBTable, IBDataset etc..

fefe13 05-11-2005 14:22:40

busqueda ttable
 
Es cierto el locatenext no sigue para los ttables.Alguna otra idea?Gracias


La franja horaria es GMT +2. Ahora son las 07:06:13.

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