Fórum Mostrar resultado adoquery no treeview #375094
20/09/2009
0
Olá alguém pode me ajudar como fazer para mostrar o resultado da query no treeview?
Quero listar toos os registros de um campo da consulta no treeview.
Já aprendi a pegar as tabelas e os campos do banco ( em outro tópico) e estou tentando adaptar mas não consigo..
Obrigada!
Quero listar toos os registros de um campo da consulta no treeview.
Já aprendi a pegar as tabelas e os campos do banco ( em outro tópico) e estou tentando adaptar mas não consigo..
Obrigada!
Jaqque
Curtir tópico
+ 0
Responder
Posts
23/09/2009
Jaqque
Alguém pode me ajudar por favor??
Fiz o código abaixo,para testar, só que os valores não aprecem.
procedure TForm1.Button1Click(Sender: TObject);
var NomeC: String;
begin
NomeC := ComboBox1.Items.Text;
ADOQuery2.Close;
ADOQuery2.SQL.Add(´select distinct dimensao´);
ADOQuery2.SQL.Add(´from tbl_dimensao d, tbl_cubo c´);
ADOQuery2.SQL.Add(´where d.cubo = c.cubo´);
ADOQuery2.SQL.Add(´and c.nome = :Nome´);
ADOQuery2.Parameters.ParamByName(´Nome´).Value := NomeC;
ADOQuery2.Open;
with TreeView1 do
begin
while not ADOQuery2.Eof do
begin
TreeView1.Items.Add(nil, VarToStr(ADOQuery2.FieldByName(´dimensao´).Value));
end;
ADOQuery2.Next;
end;
Next;
end;
Obrigada!
Fiz o código abaixo,para testar, só que os valores não aprecem.
procedure TForm1.Button1Click(Sender: TObject);
var NomeC: String;
begin
NomeC := ComboBox1.Items.Text;
ADOQuery2.Close;
ADOQuery2.SQL.Add(´select distinct dimensao´);
ADOQuery2.SQL.Add(´from tbl_dimensao d, tbl_cubo c´);
ADOQuery2.SQL.Add(´where d.cubo = c.cubo´);
ADOQuery2.SQL.Add(´and c.nome = :Nome´);
ADOQuery2.Parameters.ParamByName(´Nome´).Value := NomeC;
ADOQuery2.Open;
with TreeView1 do
begin
while not ADOQuery2.Eof do
begin
TreeView1.Items.Add(nil, VarToStr(ADOQuery2.FieldByName(´dimensao´).Value));
end;
ADOQuery2.Next;
end;
Next;
end;
Obrigada!
Responder
Gostei + 0
Clique aqui para fazer login e interagir na Comunidade :)