in attesa di un aiuto
mi sono aiutato da solo
nella pagina metto:
<asp:TreeView ID="TreeView1" runat="server" ShowLines="True" AutoGenerateDataBindings="false" ShowExpandCollapse="true"></asp:TreeView>
codice
codice:
Protected Sub Button8_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button8.Click
Dim conn As o.OracleConnection = Nothing
Try
conn = New o.OracleConnection(gl.StringaConnessione)
conn.Open()
BindTreeView(conn)
Catch er As Exception
l.MessaggioErrore(er)
Finally
If conn IsNot Nothing Then conn.Close()
End Try
End Sub
Protected Sub BindTreeView(ByVal conn As o.OracleConnection)
Me.TreeView1.Nodes.Clear()
Dim dt As DataTable = conn.GetSchema("ForeignKeys") 'elenco delle tabelle
Dim nodo As New TreeNode("text", "value")
nodo.SelectAction = TreeNodeSelectAction.Expand
nodo.Collapse()
Me.TreeView1.Nodes.Add(nodo)
PopolaTreeView("value", dt, nodo)
End Sub
Private Sub PopolaTreeView(ByVal id As String, ByVal dt As DataTable, ByVal nodo As TreeNode)
Dim rows As DataRow() = dt.Select(String.Format("PRIMARY_KEY_OWNER = 'PIETRO' AND PRIMARY_KEY_TABLE_NAME = '{0}'", id), "FOREIGN_KEY_TABLE_NAME")
For i As Integer = 0 To rows.Length - 1
Dim childNode As New TreeNode(rows(i).Item("FOREIGN_KEY_TABLE_NAME").ToString(), CStr(rows(i)("PRIMARY_KEY_TABLE_NAME")))
childNode.SelectAction = TreeNodeSelectAction.Expand
childNode.Collapse()
nodo.ChildNodes.Add(childNode)
PopolaTreeView(CStr(rows(i)("FOREIGN_KEY_TABLE_NAME")), dt, childNode)
Next
End Sub