Duvida em como utilizar Query

Delphi

24/05/2006

Boa Tarde tenho duas (2) Tabelas Paradox e estou fazendo um Update em uma delas utilizando dados da outra Tabela... conexâo normal com Table e Datasource o codigo é
procedure TForm4.BitBtn1Click(Sender: TObject);
begin
 Table1.Open;
 Table2.Open;
//  Table1.First;
  while not(Table1.eof) do begin  //Enquanto não for o fim da tabela
query1.SQL.Text := ´UPDATE CLI SET CGCCPF =: CGC2 WHERE CGC =:COD ´;
QUERY2.ParamByName(´COD´).AsString := TABLE1.fieldbyname(´CGC´).Value;
QUERY2.ParamByName(´Cgc2´).Value := TABLE1.fieldbyname(´CGCCPF´).Value;
Query1.ExecSQL;
table1.Next


Ao executar a aplicação ocorre o seguinte erro ´Query2: Parameter ´COD´ not found´ estou precisando de uma ajuda com esse erro....


Misael

Misael

Curtidas 0

Respostas

Misael

Misael

24/05/2006

Descobri kara
begin
 Table1.Open;
 //  Table1.First;
  while not(Table1.eof) do begin  //Enquanto não for o fim da tabela
query1.SQL.Text := ´UPDATE CLI SET CGCCPF =:CGC2 WHERE CGC =:COD´;
query1.Params.CreateParam(ftString, ´COD´,ptInput);
//query2.Params.CreateParam(ftString, ´COD´,ptInput);
QUERY1.ParamByName(´COD´).Value := TABLE1.fieldbyname(´CGC´).Value;
query1.Prepared:= False;
//query2.Prepared:= False;
query1.Params.CreateParam(ftString, ´CGC2´,ptInput);
//query2.Params.CreateParam(ftString, ´CGC2´,ptInput);
QUERY1.ParamByName(´Cgc2´).asString := TABLE1.fieldbyname(´CGCCPF´).asString;
query1.Prepared:= False;
//query2.Prepared:= False;
Query1.ExecSQL;
table1.Next



GOSTEI 0
POSTAR