Hey guys,

So, I have a CheckedListBox that will be used to choose what columns they want to select from a database. Is it at all possible to display it in the format of [Table Name].[Column Name]?

So far I have this:

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

        clbFields.BeginUpdate()
        clbFields.DataSource = theTables
        clbFields.DisplayMember = "Table_Name"
        clbFields.EndUpdate()

        con.Close()

I tried adding another clbFields.DisplayMember, but this obviously just overwrites the table name with the column name. I also tried doing:

clbFields.DisplayMember = "Table_Name" & "." & "Column_Name"

but that didn't work either. Was worth a try though lol.

I know it's not exactly life threatening if the user can only see the column name, but it'd be nice to be able to see the table name in case of any duplications :)

Thanks in advance for any help :)

Recommended Answers

All 2 Replies

You can concatenate table name and column name in TheQuery you've used to populate theTables and use that instead.

:O you're a genius! I'd completely forgotten about concatenation lol.

Thank you very much :)

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.