Locate com mais de um campo

Delphi

27/09/2003

O locate funciona em uma pesquisa que o campo seja composto

Por exemplo pesquisar

if dm.CDT_TAB2.Locate(´TAB_COD´;´ TAB_KEY´ , dbedit1.text ;dbedit3.Text
,[]) then
Begin
..
..
..


Só que está dando erro


Nilson Junior

Nilson Junior

Curtidas 0

Respostas

Marcelo.c

Marcelo.c

27/09/2003

Qual erro ?


GOSTEI 0
Vinicius2k

Vinicius2k

27/09/2003

Nilson,
Para aplicar o método locate com mais de um campo vc precisa fazer uso da função VarArrayOf... a forma de informação do 1º parametro tbm estah incorreta...
IMPORTANTE : acrescente na lista de uses a unit ´Variants´...

if dm.CDT_TAB2.Locate(´TAB_COD;TAB_KEY´ , VarArrayOf([dbedit1.text,dbedit3.Text]),[]) then begin .. .. .. end;

espero ter ajudado...


GOSTEI 0
Misael

Misael

27/09/2003

tenta desse jeito:
Locate ( ´tab_cod, tab_key´, vararrayof [dbedit1.text , dbedit3.text] , [])then
begin
...............
.............
end;


GOSTEI 0
Vinicius2k

Vinicius2k

27/09/2003

Misael, esta sintaxe estah errada...

tenta desse jeito: Locate ( ´tab_cod, tab_key´, vararrayof [dbedit1.text , dbedit3.text] , [])then begin ............... ............. end;


o correto eh :

if dm.CDT_TAB2.Locate(´TAB_COD;TAB_KEY´ , VarArrayOf([dbedit1.text,dbedit3.Text]),[]) then begin .. .. .. end;


como eu jah havia passado ao colega...


GOSTEI 0
POSTAR