treeview中前面都是父节点,只有到了第5个才是子节点,程序只需要从第5个开始选中,listview才显示相关的数据,且数据是从两个表中导出,以下的代码如下,但是不行,我不知错在那里,有那位高手可否指点一二,在此先行谢过。
procedure Tmainpagefrm.TreeView1Changing(Sender: TObject; Node: TTreeNode;
var AllowChange: Boolean);
var
titem:tlistitem;
n:integer;
begin
with mindatamodule.adotgp,mindatamodule.adoqrycustlist,listview1 do
begin
if treeview1.Selected.AbsoluteIndex>4 then
sql.Clear;
sql.Add('select tcustomer.cust_no,tcustomer.cust_name,tcustomer.cust_bp,tcustomer.bp_code,tcustomer.bp_type,tcustomer.reg_date,tcustomer.unreg_date,tcustomer.mobile,tcustomer.email from tgp_cust,tcustomer where tgp_cust.cust_no=tcustomer.cust_no and tgp_cust='+quotedstr(node.Text));
open;
listview1.Clear;
repeat
n:=n+1;
titem:=listview1.Items.Add;
titem.Caption:=inttostr(n);
titem.SubItems.Add(fieldbyname('cust_no').AsString );
titem.SubItems.Add(fieldbyname('cust_name').AsString);
titem.SubItems.Add(fieldbyname('cust_bp').AsString);
titem.SubItems.Add(fieldbyname('bp_code').AsString);
titem.SubItems.Add(fieldbyname('bp_type').AsString);
titem.SubItems.Add(fieldbyname('reg_date').AsString);
titem.SubItems.Add(fieldbyname('unreg_date').AsString);
titem.SubItems.Add(fieldbyname('mobile').AsString);
titem.SubItems.Add(fieldbyname('email').AsString);
next;
until
eof;
end;
end;
end.
procedure Tmainpagefrm.TreeView1Changing(Sender: TObject; Node: TTreeNode;
var AllowChange: Boolean);
var
titem:tlistitem;
n:integer;
begin
with mindatamodule.adotgp,mindatamodule.adoqrycustlist,listview1 do
begin
if treeview1.Selected.AbsoluteIndex>4 then
sql.Clear;
sql.Add('select tcustomer.cust_no,tcustomer.cust_name,tcustomer.cust_bp,tcustomer.bp_code,tcustomer.bp_type,tcustomer.reg_date,tcustomer.unreg_date,tcustomer.mobile,tcustomer.email from tgp_cust,tcustomer where tgp_cust.cust_no=tcustomer.cust_no and tgp_cust='+quotedstr(node.Text));
open;
listview1.Clear;
repeat
n:=n+1;
titem:=listview1.Items.Add;
titem.Caption:=inttostr(n);
titem.SubItems.Add(fieldbyname('cust_no').AsString );
titem.SubItems.Add(fieldbyname('cust_name').AsString);
titem.SubItems.Add(fieldbyname('cust_bp').AsString);
titem.SubItems.Add(fieldbyname('bp_code').AsString);
titem.SubItems.Add(fieldbyname('bp_type').AsString);
titem.SubItems.Add(fieldbyname('reg_date').AsString);
titem.SubItems.Add(fieldbyname('unreg_date').AsString);
titem.SubItems.Add(fieldbyname('mobile').AsString);
titem.SubItems.Add(fieldbyname('email').AsString);
next;
until
eof;
end;
end;
end.
解决方案 »
- 旷世难题,无类型指针指向DLL里的函数,导致的Access violation错误,高手请进,在线急等!!!!!!
- Twebbrowser中如何显示菜单条
- [僵哥]你你你。。。。
- 关于intstack的问题!
- 如何得到一个进程内存中的基地址?
- 求一判断字段是各类型的函数!在线等
- 界面突然不能加载了,高手帮帮忙!
- 初学delphi,问一个TRadioGroup.itemindex的问题。请看代码。谢谢。
- 100分求教:用什么控件可以进行可视化网页设计
- 如果截获win2000中受到的消息?如在win98中使用winpopup发出的消息!
- Series(FastSeries)上面添加曲线的问题?
- TWordApplication操作word如何禁用工具栏按钮,如打印按钮?
tgp_cust='+quotedstr(node.Text));tgp_cust是表名?