<iewc:TreeView runat= server ID= Treeview NAME= Treeview >
<iewc:TreeNode id= Treenode runat= server TreeNodeSrc= menuone txt Expanded= True Text= 信息類別列表 >
</iewc:TreeNode>
</iewc:TreeView>
其中menuone
<TREENODES>
<treenode text= 蔬菜 NavigateUrl= xxcb_add aspx?classname=蔬菜&classid= ? Target= main >
<treenode text= 白菜 NavigateUrl= xxcb_add aspx?classname=白菜&classid= ?? Target= main />
<treenode text= 蘿卜 NavigateUrl= xxcb_add aspx?classname=蘿卜&classid= ?? Target= main />
<treenode text= 黃花菜 NavigateUrl= xxcb_add aspx?classname=黃花菜&classid= ?? Target= main />
</treenode>
<treenode text= 水果 NavigateUrl= xxcb_add aspx?classname=水果&classid= ? Target= main >
<treenode text= 蘋果 NavigateUrl= xxcb_add aspx?classname=蘋果&classid= ? Target= main >
<treenode text= 紅富士 NavigateUrl= xxcb_add aspx?classname=紅富士&classid= ?? Target= main />
<treenode text= 其它蘋果 NavigateUrl= xxcb_add aspx?classname=其它蘋果&classid= ?? Target= main />
</treenode>
<treenode text= 桃子 NavigateUrl= xxcb_add aspx?classname=桃子&classid= ?? Target= main />
<treenode text= 荔枝 NavigateUrl= xxcb_add aspx?classname=荔枝&classid= ?? Target= main />
</treenode>
<treenode text= 糧食 NavigateUrl= xxcb_add aspx?classname=糧食&classid= ? Target= main >
<treenode text= 大米 NavigateUrl= xxcb_add aspx?classname=大米&classid= ?? Target= main />
<treenode text= 玉米 NavigateUrl= xxcb_add aspx?classname=玉米&classid= ?? Target= main />
</treenode>
</TREENODES>
現在的問題變成了如何將數據表根據
Imports System IO
Dim txtwriter As StreamWriter
txtwriter = File CreateText(Server MapPathstrpath ( \menuone txt ))
txtwriter WriteLine( <TREENODES> )
Dim objConn As OleDbConnection
Dim objCmd As OleDbCommand
Dim objRead As OleDbDataReader
Dim strSQL strDSN As String
Dim strid strname strid strname As String
Dim strand As String
strand = &
Dim i j k m As Integer
i =
j =
k =
m =
strSQL = select * from class order by classid
objConn = New OleDbConnection(ConfigurationSettings AppSettings( connString ))
objCmd = New OleDbCommand(strSQL objConn)
objCmd Connection Open()
objRead = objCmd ExecuteReader()
While objRead Read()
If j = Then
j = Len(Trim(objRead Item( classid )))
Else
strid = strid
strname = strname
i = Len(Trim(objRead Item( classid )))
k = i j
Select Case k
Case Is >
txtwriter WriteLine( <treenode text= & strname & NavigateUrl= xxcb_add aspx?classname= & strname & & strand & classid= & strid & Target= main > )
Case Is =
txtwriter WriteLine( <treenode text= & strname & NavigateUrl= xxcb_add aspx?classname= & strname & & strand & classid= & strid & Target= main /> )
Case Is <
txtwriter WriteLine( <treenode text= & strname & NavigateUrl= xxcb_add aspx?classname= & strname & & strand & classid= & strid & Target= main /> )
txtwriter WriteLine( </treenode> )
m = k
While m <
txtwriter WriteLine( </treenode> )
m = m +
End While
End Select
j = Len(Trim(objRead Item( classid )))
End If
strid = Trim(objRead Item( classid ))
strname = Trim(objRead Item( classname ))
End While
strid = strid
strname = strname
i = Len(strid)
k = j i
strid = strid
strname = strname
Select Case k
Case Is >
txtwriter WriteLine( <treenode text= & strname & NavigateUrl= xxcb_add aspx?classname= & strname & & strand & classid= & strid & Target= main /> )
txtwriter WriteLine( </treenode> )
m = Len(strid) /
While m >
txtwriter WriteLine( </treenode> )
m = m
End While
Case Is =
txtwriter WriteLine( <treenode text= & strname & NavigateUrl= xxcb_add aspx?classname= & strname & & strand & classid= & strid & Target= main /> )
txtwriter WriteLine( </treenode> )
m = Len(strid) /
While m >
txtwriter WriteLine( </treenode> )
m = m
End While
Case Is <=
txtwriter WriteLine( <treenode text= & strname & NavigateUrl= xxcb_add aspx?classname= & strname & & strand & classid= & strid & Target= main /> )
txtwriter WriteLine( </treenode> )
m = Len(strid) /
While m >
txtwriter WriteLine( </treenode> )
m = m
End While
End Select
txtwriter WriteLine( </TREENODES> )
txtwriter Close()
From:http://tw.wingwit.com/Article/program/net/201311/13797.html