本文介绍了如何在vb.net连接Ms填充树视图访问数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我用这个编码来填充树视图
I used this coding to fill the tree view
If (con.State = ConnectionState.Closed) Then
con.Open()
End If
Dim cmd As New OleDbCommand("select Sid,Sname from Subject ", con)
Dim Sub_subject As New OleDbCommand("select Sub_ID,Sub_Name from Sub_Subject ", con)
Dim Category As New OleDbCommand("select Cid,Cname from Category ", con)
Dim Sub_Category As New OleDbCommand("select Sub_Cid,Sub_Cname from Sub_Category", con)
Dim Fileupload As New OleDbCommand("select Sub_Cid,FileUpload from FileUpload", con)
Dim dr As OleDbDataReader
dr = cmd.ExecuteReader
Dim dr_sub As OleDbDataReader
dr_sub = Sub_subject.ExecuteReader
Dim dr_Category As OleDbDataReader
dr_Category = Category.ExecuteReader
Dim dr_sub_cat As OleDbDataReader
dr_sub_cat = Sub_Category.ExecuteReader
Dim dr_file As OleDbDataReader
dr_file = Fileupload.ExecuteReader
While dr.Read() And dr_sub.Read() And dr_Category.Read() And dr_sub_cat.Read()
TreeView1.Nodes.Add(dr(1).ToString).Nodes.Add(dr_sub(1).ToString).Nodes.Add(dr_Category(1).ToString).Nodes.Add(dr_sub_cat(1).ToString)
End While
dr.Close()
dr_sub.Close()
dr_Category.Close()
dr_sub_cat.Close()
dr_file.Close()
con.Close()
Catch ex As Exception
End Try
任何其他方式来填充数据库中的树视图
any another way to fill the tree view in database
推荐答案
这篇关于如何在vb.net连接Ms填充树视图访问数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!