473,385 Members | 1,409 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.

binding multiple sources to listbox

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

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 18 '05 #1
3 1735
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" <aksel.olsen@-NOSPAM-pbe.oslo.kommune.no> wrote in message
news:e6**************@TK2MSFTNGP12.phx.gbl...
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

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest

Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 18 '05 #2
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" <aksel.olsen@-NOSPAM-pbe.oslo.kommune.no> wrote in message
news:e6**************@TK2MSFTNGP12.phx.gbl...
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

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest

Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 18 '05 #3
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!

---
Posted using Wimdows.net NntpNews Component - Posted from .NET's Largest Community Website: http://www.dotnetjunkies.com/newsgroups/
Nov 18 '05 #4

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

Similar topics

4
by: Jason | last post by:
Here is an odd issue. I am trying to shed some light on why this is causing a problem. I have an ArrayList. I am binding it to a ListBox control with has its Sort property set to True. If the...
3
by: me | last post by:
I've included a picture below to show what I am trying to accomplish. It is best to copy/paste into notepad to get the spacing correct. I have a dataset that contains 3 tables. Two of the tables...
0
by: popsovy | last post by:
Hi I have a question about whether Data Binding can facilitate the process of saving data in a web application I learned that you can data bind information from a number of different data...
8
by: Richard L Rosenheim | last post by:
I have a dataset containing a parent table related to a child table. The child table contains an ID field (which is configured as autonumber in the datatable), the ID of the parent, plus some...
1
by: JNariss | last post by:
Hello, I have created a form called frmS2P with the following: 1 listbox called List11 which holds the contents of a query created off my table called tblRequestActions. The fields which the...
1
by: A. Spiehler | last post by:
I'm trying to fill a listBox control with string members from an array of objects. I think using data binding is supposed to be the easiest way to do this. I've never used data binding before and...
2
by: bbepristis | last post by:
Hey all I maybe way off base here but I am trying to do a select * from 'csv file' then take the return data and insert it into textboxes for example column company into companytxt.text ext... here...
0
by: EricLondaits | last post by:
Hi, I have an ASP.NET page with a ListBox that is data bound to a table with a single field (it holds a list of valid IDs). The page also has a textBox into which you can add new valid IDs, one...
0
by: furqanms | last post by:
Hello, I am new to WPF ,I am developing touch screen system using WPF. I am facing problem in Binding relative reference. Here is my code : <UserControl x:Class="uctlBrowser" ...
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: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
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.