Selecionar Registro

Delphi

23/10/2007

Tenho um DataGrid onde tenho a opção ´Select´ ou ´Selecionar´, gostaria de clicar nesse link e me aparecer os dados do txtID, txtDescricao na mesma paginas ASP.Net, somente preencher os dados confome eu selecionar o registro. Tentei colcoar isso no ItemCommand do DataGrid, mas não rolou.


if e.CommandName = ´Select´ then
begin
SQLConexao.Open;
try
cmdBens.Parameters.Add(´@Descricao´, FbDbType.VarChar, 6, ´ID´).Value :=
DataGrid1.DataKeys[e.Item.ItemIndex];
DataGrid2.DataSource := cmdBens.ExecuteReader;
DataGrid2.DataBind;

finally
SQLConexao.Close;
end;
end;

Se alguem puder me ajudar, eu agradeço muito, valeu.


Pauloroger

Pauloroger

Curtidas 0

Respostas

Pauloroger

Pauloroger

23/10/2007

Descobri:


procedure TWebForm1.btLocaliza_Click(sender: System.Object; e: System.EventArgs);
var

DataReader: SQLDataReader;

begin
//Localiza Registro

Conexao.Open;

try
cmdLocalizar.Parameters[´@ID´].Value := txtID.Text;
DataReader := cmdLocalizar.ExecuteReader;

if Datareader.read then
begin

txtID.Text := DataReader[´ID´].toString;
txtTratamento.Text := DataReader[´TRATAMENTO´].ToString;

end;
finally
Conexao.Close;
end;



end;


GOSTEI 0
Knight_of_wine

Knight_of_wine

23/10/2007

Pô não lembro de ter visto esse post.

heheheheheheheehehe.

Mas isso é o ideal e ainda responde a ideia de um outro cara ali.


GOSTEI 0
POSTAR