473,385 Members | 1,396 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Combobox display reference table2 and value Table1

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
0 1066

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: amber | last post by:
Hello After searching around on the internet, I have figured out how to populate a combobox (from a SQL table (table1)) but now I have a few more questions This combobox is on a form, that contains...
5
by: Greg Dunn | last post by:
I have two tables in a parent-child relationship. Details on the tables are as shown below: Table1 ------- Item_ID (primary key) Item_Owner (foreign key to Table2) Table2 -------
3
by: Dino L. | last post by:
Hi, I have a problem, and I just cant fint a good way to solve it. I have 3 tables in my DB Table1 ------- IDTable1 .... Table2
1
by: Ben | last post by:
Hello, I have en connection string which use 2 tables... I have a combobox which : - Display a value from TABLE1 - the value from TABLE2 But it doesn't run :-((
2
by: dbuchanan | last post by:
Hello, Windows forms & database What are the considerations when choosing how to display reference information from the calling form? What is recommended? Table1 is the parent of Table2. ...
11
by: DSR | last post by:
Help Please... I would like to populate a combo box on a form with a query that compares data from two tables. Any record that is unique in table1 should continue to populate my combobox. The...
6
by: Garry Jones | last post by:
I want to link two tables together to create a list. The unique value loppnum appears in both tables. I need to look up its corresponding value for each entry. table1 has 2 cols A Jag D Cht E...
14
by: Yas | last post by:
Hello, I have 2 tables, Table1 and Table2. I have copied all data from Table1 to Table2. However Table1 is dynamic it has new rows added and some old rows modified everyday or every other...
4
by: beary | last post by:
Hi, I have 2 tables as follows: table1 (studid,studfirst,studlast) table2 (resid,studid,resnum,resgrade) In table 1 are 2 records: Record 1: '1','Michael','Jackson' Record 2:...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.