Private Sub FillTitlesForAuthors(ByVal node As TreeNode) Dim CategorID As Integer = node.Value Dim connString As String = ConfigurationManager.ConnectionStrings("autodib").ConnectionString Dim connection As New OleDb.OleDbConnection(connString) Dim command As New OleDb.OleDbCommand("Select Produkti.ProdID,Produkti.ImeProd From Produkti" + " Inner Join Kategoria on Kategoria.CategorID = Produkti.CategorID " + " Where Kategoria.CategorID = '" + CategorID + "'", connection) Dim adapter As New OleDb.OleDbDataAdapter(command) Dim titlesForAuthors As New DataSet() adapter.Fill(titlesForAuthors) If titlesForAuthors.Tables.Count > 0 Then Dim row As DataRow For Each row In titlesForAuthors.Tables(0).Rows Dim NewNode As TreeNode NewNode = New TreeNode(row("ImeProd").ToString(), row("ProdID").ToString()) NewNode.PopulateOnDemand = False NewNode.SelectAction = TreeNodeSelectAction.None node.ChildNodes.Add(NewNode) Next End If End
Dim command As New OleDb.OleDbCommand("Select Produkti.ProdID,Produkti.ImeProd From Produkti" + " Inner Join Kategoria on Kategoria.CategorID = Produkti.CategorID " + " Where Kategoria.CategorID = " + CategorID, connection)