Fórum Deletar com Query #154556
13/04/2003
0
Como faço pra apagar um registro de uma tabela usando query?
Pabhen
Curtir tópico
+ 0
Responder
Posts
13/04/2003
Joilson_gouveia
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;
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;
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)