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, strid1, strname1 As String
Dim strand As String
strand = "&"
Dim i, j, k, m As Integer
i = 0
j = 0
k = 0
m = 0
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 = 0 Then
j = Len Trim objRead.Item "classid")))
Else
strid = strid1
strname = strname1
i = Len Trim objRead.Item "classid")))
k = i - j
Select Case k
Case Is > 0
txtwriter.WriteLine "<treenode text=’" & strname & "’ NavigateUrl=’xxcb_add.aspx?classname=" & strname & "" & strand & "classid=" & strid & "’ Target=’main1’>")
Case Is = 0
txtwriter.WriteLine "<treenode text=’" & strname & "’ NavigateUrl=’xxcb_add.aspx?classname=" & strname & "" & strand & "classid=" & strid & "’ Target=’main1’/>")
Case Is < 0
txtwriter.WriteLine "<treenode text=’" & strname & "’ NavigateUrl=’xxcb_add.aspx?classname=" & strname & "" & strand & "classid=" & strid & "’ Target=’main1’/>")
’txtwriter.WriteLine "</treenode>")
m = k
While m < 0
txtwriter.WriteLine "</treenode>")
m = m + 2
End While
End Select
j = Len Trim objRead.Item "classid")))
End If
strid1 = Trim objRead.Item "classid"))
strname1 = Trim objRead.Item "classname"))
End While
’strid = strid1
’strname = strname1
i = Len strid)
k = j - i
strid = strid1
strname = strname1
Select Case k
Case Is > 0
txtwriter.WriteLine "<treenode text=’" & strname & "’ NavigateUrl=’xxcb_add.aspx?classname=" & strname & "" & strand & "classid=" & strid & "’ Target=’main1’/>")
’txtwriter.WriteLine "</treenode>")
m = Len strid) / 2
While m > 1
txtwriter.WriteLine "</treenode>")
m = m - 1
End While
Case Is = 0
txtwriter.WriteLine "<treenode text=’" & strname & "’ NavigateUrl=’xxcb_add.aspx?classname=" & strname & "" & strand & "classid=" & strid & "’ Target=’main1’/>")
’txtwriter.WriteLine "</treenode>")
m = Len strid) / 2
While m > 1
txtwriter.WriteLine "</treenode>")
m = m - 1
End While
Case Is <= 0
txtwriter.WriteLine "<treenode text=’" & strname & "’ NavigateUrl=’xxcb_add.aspx?classname=" & strname & "" & strand & "classid=" & strid & "’ Target=’main1’/>")
’txtwriter.WriteLine "</treenode>")
m = Len strid) / 2
While m > 1
txtwriter.WriteLine "</treenode>")
m = m - 1
End While
End Select
txtwriter.WriteLine "</TREENODES>")
txtwriter.Close )
|