vb.net treeview 数据库绑定 20
DimsdaAsOleDbDataAdapter=NewOleDbDataAdapter("select*from明细",con)DimdtAsNewDataTables...
Dim sda As OleDbDataAdapter = New OleDbDataAdapter("select * from 明细", con)
Dim dt As New DataTable
sda.Fill(dt)
Dim r1 As DataRow() = dt.Select("NO =" & 1)
For Each tt1 As DataRow In r1
Dim t1 As String = " "
Dim t2 As String = tt1.Item("id").ToString.Trim
Dim T3 As String = tt1.Item("name").ToString.Trim
Dim itme As TreeNode = New TreeNode(t2 + t1 + T3)
TreeView1.Nodes.Add(itme)
Next
在网上查了很多,最终绑定数据还是库无法成功,子节点还不知道怎么写,请大神指点。
明细表 有3个字段:ID NAME NO 展开
Dim dt As New DataTable
sda.Fill(dt)
Dim r1 As DataRow() = dt.Select("NO =" & 1)
For Each tt1 As DataRow In r1
Dim t1 As String = " "
Dim t2 As String = tt1.Item("id").ToString.Trim
Dim T3 As String = tt1.Item("name").ToString.Trim
Dim itme As TreeNode = New TreeNode(t2 + t1 + T3)
TreeView1.Nodes.Add(itme)
Next
在网上查了很多,最终绑定数据还是库无法成功,子节点还不知道怎么写,请大神指点。
明细表 有3个字段:ID NAME NO 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询