binding multiple sources to listbox

  • Thread starter Thread starter axlchris
  • Start date Start date
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
 
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/
 
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/
 
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!
 
Back
Top