cellus205 0 Junior Poster in Training

Im having trouble trying to pass a parameter to a SQL query that I am trying to run on a DataTable, that Im using to Dynamically populate a treeview. Im not having any trouble filling the first nodes, but to fill the second nodes, I have to use a query to check the correct parent node to add the child node. Heres the code:

For Each QRow2 In QTable2.Rows
            rootnode = basenode.Nodes.Add(CStr(QRow2("Subject")))
            For Each QRow In QTable.Rows
                rootnode = basenode.Nodes.Item(CInt(QTable2.Select("RowNum WHERE Filename = " & QRow("Filename"))
                childnode = rootnode.Nodes.Add(QRow("Filename"))

Where QTable2 is the datatable I need to query, RowNum is a DataRow, and I need to return the row number where the filename from QTable = QTable2.

Any help would be greatly appreciated!