0
Good evening folks! I recently joined the Delphi world and created some client registration applications using the Mysql database. The records added to the database are shown in a Dbgrid and when double-clicking on the record, opens the Pagecontrol page where the data is recorded, deleted and edited. So far so good, but when clicking the button to edit the record, all Dbedits of the registration page change to the last registration done in the system. Someone could help me solve this mistake?
Click from the Dbgrid:
procedure TFrmUsuarios.DBGrid1DblClick(Sender: TObject);
begin
dm.tb_Usuarios.Active := True;
dm.tb_Usuarios.Edit;
txt_Nome.Text := dm.sql_con_usuariosnome.Value;
txt_Id.Text := IntToStr (dm.sql_con_usuariosid.Value);
txt_Senha.Text:= dm.sql_con_usuariossenha.Value;
ChamarDetalhes;
ConfigBotoes;
HabilitarCampos;
end;
Click the Edit button:
procedure TFrmUsuarios.btn_alterarClick(Sender: TObject);
begin
dm.tb_Usuarios.Active := True;
dm.tb_Usuarios.Edit;
ChamarDetalhes;
ConfigBotoes;
HabilitarCampos;
end;
From Now Thank You!!
We need to know what these methods do: Call Details, Configbotoes and Enable Fields.
– Junior Moreira
There are some inconsistencies between the code you showed and what you wrote. Datasource on your Dbgrid is linked to which data component (
txt_Nome.Text
). That onedm.sql_con_usuariosnome.Value
is a Tfield? if yes, of which Ttable?– Marcio Rodrigues