cellus205 0 Junior Poster in Training

Right now Im having trouble getting data from a MySQL table and creating a new datatable to store this. I have a TreeView control that I am trying to dynamically add nodes to. The query that I have is returning the Attachments column of all rows where Owner = (parameter), which I am trying to store in the table, QTable. The query works as needed in the Query Builder, but I am getting a restraint error when trying to actually build the program.

SQL Query:

SELECT     Attachments.Filename
FROM         Users INNER JOIN
                      Tickets ON Users.id = Tickets.Owner INNER JOIN
                      Attachments ON Users.id = Attachments.Creator
WHERE     (Users.EmailAddress = @Email) AND (Attachments.Filename IS NOT NULL)

.Net Code:

Public Sub WorkQ()
        'Populates the Work Queue from BatchTable

        Dim J As Integer
        Dim rootnode As TreeNode
        Dim childnode As TreeNode
        Dim R As Integer = 1

        Dim basenode As TreeNode

        'Number of tickets assigned to currently logged in user
        Dim tickCount As Integer
        Dim QTable As New rtdbDataSet.AttachmentsDataTable
        QTable = AttachmentsTableAdapter.GetQ1(lognm.Text)
        Dim QRow As DataRow
        tickCount = TicketsTableAdapter.TicketCount(CInt(UsersTableAdapter.GetID(CStr(lognm.Text))))

        'QTable = TicketsTableAdapter.GetDataBy2(lognm.Text)
        TicketsTableAdapter.Connection.Open()

        For Each QRow In QTable.Rows
            rootnode = basenode.Nodes.Add(QRow("Filename"))
        Next

Any help would be greatly appreciated!

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.