Deletar com Query

Delphi

13/04/2003

Como faço pra apagar um registro de uma tabela usando query?


Pabhen

Pabhen

Curtidas 0

Respostas

Joilson_gouveia

Joilson_gouveia

13/04/2003

procedure Tform1.Excluir(CodCliente);
var
qryExcluir:TQuery;
begin
qryExcluir := TQuery.Create(self);
with qryExcluir do
begin
DatabaseName := (Nome do Seu DataBase);
SessionName := ´Default´;
RequestLive := True //Para aceitar Gravação
SQL.Text := ´DELETE FROM CLIENTES WHERE CODCLI=:CODCLI´;
ParamByName(´CODCLI´).AsInteger := CodCliente;
Try
ExecSQL;
Close;
Free;
except
ShowMessage(´Não foi possível excluir cliente ´+IntToStr(CodCliente))
end;
end;
end;


GOSTEI 0
POSTAR