Erro dbExpress: Invalid handle
13/05/2008
0
Alguém sabe o motivo que ocorre o erro ´invalid handle´ quando faço vários inserts em uma tabela usando o SQLDataSet do dbExpress?
Obrigado.
Obrigado.
Lperosa
Curtir tópico
+ 0
Responder
Posts
13/05/2008
Paulo
Provavelmente vc está dando um INSERT e em seguida um Open. Caso seja isso, de um EXecute e depois um select seguido de Open.
Responder
13/05/2008
Lperosa
O que faço na realizade é um for com um delete e um insert dentro dele, por exemplo:
for i:=1 to 10 do
begin
with SQLDataSet do
begin
Close;
CommandType := ctQuery;
CommandText := ´ DELETE FROM Teste ´+
´ WHERE CodTeste = :CODTESTE ´;
Params.ParamByName(´CODTESTE´).AsInteger := i;
ExecSQL;
Close;
CommandType := ctQuery;
CommandText := ´ INSERT INTO Teste( ´+
´ CodTeste) ´+
´ VALUES( ´+
´ :CODTESTE) ´+
Params.ParamByName(´CODTESTE´).AsInteger := i;
ExecSQL;
end;
end;
for i:=1 to 10 do
begin
with SQLDataSet do
begin
Close;
CommandType := ctQuery;
CommandText := ´ DELETE FROM Teste ´+
´ WHERE CodTeste = :CODTESTE ´;
Params.ParamByName(´CODTESTE´).AsInteger := i;
ExecSQL;
Close;
CommandType := ctQuery;
CommandText := ´ INSERT INTO Teste( ´+
´ CodTeste) ´+
´ VALUES( ´+
´ :CODTESTE) ´+
Params.ParamByName(´CODTESTE´).AsInteger := i;
ExecSQL;
end;
end;
Responder
Clique aqui para fazer login e interagir na Comunidade :)