473,405 Members | 2,261 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,405 software developers and data experts.

lookup databinding combobox using stored procedures

I have a lookup table with and ID field and a Description field, and another
table that has its own ID field, the ID field from the lookup table, and
other data.

LookupTable
LookupTable.ID
LookupTable.Description
OtherDataTable
OtherDataTable.ID
OtherDataTable.LookupTableID
OtherDataTable.OtherData

There are stored procedures for SELECT, INSERT, UPDATE, and DELETE that
maniuplate data in the OtherDataTable as well as another set of stored
procedures for the LookupTable.

I need to create a form that shows the details of the OtherDataTable. To
that end I've created a DataSet that contains a DataTable based on the SELECT
stored procedure for the OtherDataTable the DataTable's INSERT, UPDATE, and
DELETE commands have been set to the stored procedures and I can call them
from my code. In the details of the form I would like to use a combo box
that will allow the use to make a selection based upon the list from
LookupTable where the selected item is LookupTable.Description and the
slected value is LookupTable.ID and the LookupTable.ID value is stored in
OtherDataTable.LookupTableID. Of course as the user scrolls through the
OtherDataTable the combo box must display the appropreate selection.
Aug 6 '07 #1
2 3633
What you want to do is load the contents of LookupTable into another
data table or something of that nature, and then bind the drop down list to
that (through the DataBindings and DataSource properties). You also have to
set the ValueMember and DisplayMember properties to indicate which column on
the data table should be displayed, and which one should be used as a value.

Once you do that, you can add a binding to the control which binds your
column to the SelectedValue property. When that property changes (when an
item is selected in the list) it will update your data source, and vice
versa.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

"TD is PSP" <TD is PS*@discussions.microsoft.comwrote in message
news:9C**********************************@microsof t.com...
>I have a lookup table with and ID field and a Description field, and
another
table that has its own ID field, the ID field from the lookup table, and
other data.

LookupTable
LookupTable.ID
LookupTable.Description
OtherDataTable
OtherDataTable.ID
OtherDataTable.LookupTableID
OtherDataTable.OtherData

There are stored procedures for SELECT, INSERT, UPDATE, and DELETE that
maniuplate data in the OtherDataTable as well as another set of stored
procedures for the LookupTable.

I need to create a form that shows the details of the OtherDataTable. To
that end I've created a DataSet that contains a DataTable based on the
SELECT
stored procedure for the OtherDataTable the DataTable's INSERT, UPDATE,
and
DELETE commands have been set to the stored procedures and I can call them
from my code. In the details of the form I would like to use a combo box
that will allow the use to make a selection based upon the list from
LookupTable where the selected item is LookupTable.Description and the
slected value is LookupTable.ID and the LookupTable.ID value is stored in
OtherDataTable.LookupTableID. Of course as the user scrolls through the
OtherDataTable the combo box must display the appropreate selection.

Aug 7 '07 #2
So if I understand correctly I would have code similar to the following:

CB.DataSource = LookupTableDataSet
CB.ValueMember = LookupTable.ID
CB.DisplayMember = LookupTable.Description
CB.DataBindings.Add(?)

I'm however unclear on what I should be putting for the DataBindings.Add.
Would you please reply with some code like response. Thanks!

Aug 8 '07 #3

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

Similar topics

3
by: my-wings | last post by:
I've been reading about how evil Lookup fields in tables are, but I've got to be missing something really basic. I know this subject has been covered before, because I've just spent an hour or two...
0
by: Richard | last post by:
Hi, I'm having issues with DataBinding. I have a Form with two data bound comboboxes on it. When you select something in one combobox I may {or may not} want to change the selected item in the...
3
by: Sonny | last post by:
We are upgrading a VB6 app to VB.Net. It seems that when binding a dataview/datatable to a combobox, the property ValueMember and DisplayMember are case sensitive. So I must enter the field name...
4
by: jon f kaminsky | last post by:
Hi- I've seen this problem discussed a jillion times but I cannot seem to implement any advice that makes it work. I am porting a large project from VB6 to .NET. The issue is using the combo box...
3
by: dbuchanan | last post by:
Hello, (Windows forms - SQL Server) I fill my datagrid with a stored procedure that includes relationships to lookup tables so that users can see the values of the combobox selections rather...
5
by: Dennis | last post by:
I am trying to create a form using databinding to a dataset and one of the fields requires the user to select from a list of optons. Any hints on how to do this other than bind the field to a...
0
by: Richard Carpenter | last post by:
I am working on a small project in which I am trying to implement a data access layer through the use of a project dataset schema. Data integrity and normalization will be handled through the use...
3
by: Jimmy | last post by:
I'm not sure the subject line is a very clear description of my problem so... I have two relevant tables for this issue... the lookup table tblLookupItems with three fields . The control...
5
by: Andrus | last post by:
I'm creating a database Winforms application using VCS Express 2005 I have some large lookup tables (may be up to 500000 records) which contains name and id and are stored in sql server. I...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
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...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
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...

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.