By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,578 Members | 1,771 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,578 IT Pros & Developers. It's quick & easy.

Combobox display reference table2 and value Table1

P: n/a
Hello,

I have problem to bind a combobox and a query with 2
tables.

This a little code I Use :

Dim myDR As SqlDataReader
Dim myQuery As String = "Select Table2.IdSoc,
Table2.Nom, Table1.IdListingP From Table1, Table2 where
Table1.idsoc = Table2.IdSoc"

cnCTI = New SqlConnection(ConnectionString)

Dim myCommand As New SqlCommand(myQuery, cnCTI)

cnCTI.Open()
myDR = myCommand.ExecuteReader()

cbo.DataSource = myDR
cbo.DisplayMember = "Table2.Nom"
cbo.ValueMember = "Table1.IdListingP"

How can I bind a combobox which display a value of a table
(Table2.nom) and give a value from another table
(Table1.ListingP) ?

Who can help me ?
Thanks...

BEN
Nov 20 '05 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.