954,514 Members — Technology Publication meets Social Media
Username:
Password:
Lost login information?
Have something to say? Contribute New Article Reply to this Article

Showing query result in CheckedListBox

Hey all,

I'm trying to show some concatenated data in a CheckedListBox so that users are able to select the data for use later on. Here is the code I am using currently:

Dim con As New MySqlConnection
        Dim theQuery As New MySqlCommand
        Dim theTables As New DataTable
        Dim theAdapter As New MySqlDataAdapter
        Dim strColumns As String

        strColumns = "SELECT CONCAT( Table_Name, '.', Column_Name ) FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = 'm_fyp2011_n0218430'"


        CreateRow()

        con.ConnectionString = frmLogin.strconn

        con.Open()
        theQuery.Connection = con
        theQuery.CommandText = strColumns
        theAdapter.SelectCommand = theQuery
        theAdapter.Fill(theTables)

        clbFields.BeginUpdate()
        clbFields.DataSource = theTables
        clbFields.DisplayMember = "CONCAT(Table_Name, '.', Column_Name)"
        clbFields.EndUpdate()

        con.Close()


However, this just comes up with "System.Data.DataRowView". How can I get it to display the actual results?

Thanks in advance :)

Wolxhound90
Junior Poster in Training
55 posts since Mar 2011
Reputation Points: 10
Solved Threads: 1
 

Can I suggest you give it an alias

SELECT CONCAT( Table_Name, '.', Column_Name ) AS TableCol FROM


then use TableCol in your code.

ChrisPadgham
Posting Pro in Training
413 posts since Sep 2009
Reputation Points: 102
Solved Threads: 78
 

So simple!! Can't believe I didn't think of doing this. Thank you so much :)

Wolxhound90
Junior Poster in Training
55 posts since Mar 2011
Reputation Points: 10
Solved Threads: 1
 

This question has already been solved

Post: Markdown Syntax: Formatting Help
You
View similar articles that have also been tagged: