现有数据库表:
line(线路)
station(站点)该如何写代码,实现:
父级通过循环,列出线路
然后,点击该线路,其子级为站点+1路
-广场
-车站
-商店
line(线路)
station(站点)该如何写代码,实现:
父级通过循环,列出线路
然后,点击该线路,其子级为站点+1路
-广场
-车站
-商店
解决方案 »
- CreateWindowEx 动态创建 TOOLBAR 的几个问题!
- [怎么会有这样的限制,靠!DBGrid都支持的]DataGrid不绑定就不能使用吗???
- 奇怪,使用MSCOM控件控制信号灯,相同的程序结果却不同?
- 求指点图片放大缩小迷津!!!!
- 请教一些Printer的用法,送50分
- 怎么连局域网的数据库,或者远程的广域??
- 在VB中有没有可能把菜单放到CoolBar控件中去?
- 我做了一个软件,在2000中完全正常,可在98里必须安装MDAC_TYP才行,见内!!50分!
- 请问在VB中如何屏蔽鼠标键盘(是否要用钩子?如果是则如何用?)?如何设置快捷键?
- 发送一个data,如何使局域网中的所有开机的用户都能收到
- 关于AutoCAD二次开发中形文件的问题
- 问高手两个关于数学的问题: 集合和组合,期待您热心的回答!
Second: 在treeview的nodeclick事件中,加载该线路的站点
select * from station where lineid=node.key
判断有几个“\”
case 0
txtSQL="select * ...."
case 1
txtsql="select * ..."
case 2
txtsql="select * ..."
.....
call loadtreeview
end sub
'------加载treeview的父节点
private sub loadtreeview
dim nodex as node
dim rs as new adodb.recordset
dim conn as new adodb.connection
dim sqlstr as string'------clear nodes here
treeview1.nodes.clear
'------load root node here
set nodex=treeview1.nodes.add(,,"root","root")conn.open "string for open connection here"
sqlstr="select lineid,linename from line order by lineid"
rs.open sqlstr,conn,adOpenKeyset, _
adLockOptimistic
'------load line nodes here
if not(rs.bof or rs.eof)
do while not rs.eof
set nodex=treeview1.nodes.add("root",tvwchild,rs.fields("lineid"),rs.fields("linename"))
rs.movenext
loop
end if
if rs.state=adstateopen then
rs.close
end if
set rs=nothing
set conn=nothing
end subprivate sub treeview1_nodeclick()
dim nodx as node
dim snodx as node
dim rs as new adodb.recordset
dim conn as new adodb.connection
dim sqlstr as stringconn.open "string for open connection here"
sqlstr="select stationid,stationname from statetion where lineid="&nodx.key
rs.open sqlstr,conn,adOpenKeyset, _
adLockOptimistic
set nodx=treeview1.selecteditem
if not(rs.bof or rs.eof)
do while not rs.eof
set snodx=treeview1.nodes.add(nodx.key,tvwchild,rs.fields("lineid"),rs.fields("linename"))
rs.movenext
loop
end if
if rs.state=adstateopen then
rs.close
end if
set rs=nothing
set conn=nothing
end sub