binding multiple sources to listbox

A

axlchris

Is it possible to bind two different tables to a listbox, or do I have to iterate through the result using the datareader and manually add each item in the listbox?

thanks
 
M

Michael

It may be possible to use a UNION sql query to get results from two tables
in a single sql statement. You can also fill datasets and arrays, to bind
to the listbox as well. But if the union query doesn't work, it probably is
easiest to just use a datareader.

--Michael

axlchris said:
Is it possible to bind two different tables to a listbox, or do I have to
iterate through the result using the datareader and manually add each item
in the listbox?
Community Website: http://www.dotnetjunkies.com/newsgroups/
 
C

Curt_C [MVP]

if both tables have common fields to tie the DDL to then just use a JOIN
statement in your SQL (or would it be a UNION in this case?) either way, if
you can get one SQL statement to get your result you should be able to.

--
Curt Christianson
Owner/Lead Developer, DF-Software
www.Darkfalz.com


axlchris said:
Is it possible to bind two different tables to a listbox, or do I have to
iterate through the result using the datareader and manually add each item
in the listbox?
Community Website: http://www.dotnetjunkies.com/newsgroups/
 
A

axlchris

They have only one common field, but I can't use it to tie them together.
If I do, the result I want inside the listbox is in two different rows and I get a much bigger result than what I want.

Guess I'll use the reader to add the items manually then.

but thanks!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,755
Messages
2,569,536
Members
45,009
Latest member
GidgetGamb

Latest Threads

Top