Fórum Um duvida sobre pesquisa usando o findkey!! #173951
08/08/2003
0
O correto seria:
a) With Table1 do
begin
table1.first;
while not eof do
begin
if findkey([´XXXXXXX´]) then
........
end;
table1.next;
end;
OU
b) With Table1 do
begin
table1.first;
if findkey([´XXXXXXX´]) then
........
Preciso saber se o FindKey, procura do 1º ao ultimo registro, ou tenho
que fazer um laço While, registro a registro para procura-lo!!
a) With Table1 do
begin
table1.first;
while not eof do
begin
if findkey([´XXXXXXX´]) then
........
end;
table1.next;
end;
OU
b) With Table1 do
begin
table1.first;
if findkey([´XXXXXXX´]) then
........
Preciso saber se o FindKey, procura do 1º ao ultimo registro, ou tenho
que fazer um laço While, registro a registro para procura-lo!!
Host
Curtir tópico
+ 0
Responder
Posts
08/08/2003
Andre0201
Para utlizar o método FindKey( [] ) do dataset, vc não precisa utilizar nenhum laço while, o dataset deve estar indexado pelo campo a ser pesquisado.
Responder
Gostei + 0
08/08/2003
Atomix
Caro Alex,
para realizar uma busca (Não sensitível) em uma Tabela, utilizando-se do FindKey([]) basta que você defina o índice respectivo ao campo em que você deseja efetuar a procura. (ATENÇÃO: O ídice precisa ser definido na estruturação da Tabela)
Ex.:
Table1.IndexName := ´ID´;
Table1.Findkey([´150´]); //Localiza o registro, no o ID é igual a 150
:)
para realizar uma busca (Não sensitível) em uma Tabela, utilizando-se do FindKey([]) basta que você defina o índice respectivo ao campo em que você deseja efetuar a procura. (ATENÇÃO: O ídice precisa ser definido na estruturação da Tabela)
Ex.:
Table1.IndexName := ´ID´;
Table1.Findkey([´150´]); //Localiza o registro, no o ID é igual a 150
:)
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)