473,804 Members | 2,143 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 1753
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.kommun e.no> wrote in message
news:e6******** ******@TK2MSFTN GP12.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.kommun e.no> wrote in message
news:e6******** ******@TK2MSFTN GP12.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
5912
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 ArrayList only has one element in it everything works ok. But as soon as I have more than one element, I get the following exception when the control loads up: "Cannot modify the Items collection when the DataSource property is set.". Anybody...
3
1616
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 contain data and the third links them together. The dataset has a constraint setup as well. The first listbox and the first and last name text box are bound to the Person DataTable. As you select a name in the listbox, the textbox will be...
0
1737
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 sources to controls such as TextBox, ListBox, etc. I am clear on the concept of data flowing from data sources into web forms controls What I am not clear about is how to make the data flow the other way. When I am ready to save the changes or add a...
8
3930
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 addition fields. I'm able to get the datagrid to be properly populate with only the child records relating to the specified parent by setting the ..DefaultView.RowFilter property. Currently, to properly add a new child record, I need to manually...
1
3304
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 listbox holds are Request_ID and MoveNumber. 1 text box called Date which is populated with the default value of =Date( ).
1
2781
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 am having trouble getting it to do anything. The relevant code is below, followed by a better explanation of what I'm trying to do. // pseudocode start public delegate string StepMethod();
2
4552
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 is the code i have so far but how do I bind this together? I am fairly new to vb.net so please be understanding... here is my code: Dim conStr As String = "PageTimeout=5;Extensions={txt,csv,tab,asc};MaxScanRows=25;DefaultDir=C:\Documents" & _...
0
1856
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 per line (this is in order to make the process of adding new IDs easy, since it's only done at time of configuration). I have no problem with retrieving the contents of the textBox, splitting it into a string array, validating the individual...
0
2568
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" xmlns="http://schemas.microsoft.com/winfx/2006/xaml/presentation" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" Width="300" Height="300"> <Grid Width="Auto" Height="Auto">
0
9715
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
1
10356
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10099
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7643
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6869
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5675
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4314
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3836
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3003
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.