473,654 Members | 3,108 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Des cription
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.Des cription 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 3642
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.co m

"TD is PSP" <TD is PS*@discussions .microsoft.comwrote in message
news:9C******** *************** ***********@mic rosoft.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.Des cription
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.Des cription 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 = LookupTableData Set
CB.ValueMember = LookupTable.ID
CB.DisplayMembe r = LookupTable.Des cription
CB.DataBindings .Add(?)

I'm however unclear on what I should be putting for the DataBindings.Ad d.
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
2912
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 reading about it on google, but there is something I still don't understand, and I'm hoping someone will be willing to explain it to me in small words. Let's say I have a table for addresses, and it includes a field for state. What I would...
0
1513
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 other combobox. For reasons beyond the scope of this post I need to change the second comboboxe's selected index from within a ColumnChanging event handler. So, inside a ColumnChanging event handler I change the value of the column that is bound to...
3
1021
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 with the same case as the database. This is very hard to maintain because we have like 1000 stored procedures and I cannot make sure that the case in those are respected. Is there a way to deactivate this behavior or a workaround. In the...
4
4611
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 bound to a table as a lookup, drawing values from another table to populate the available selections. This all worked fine in VB6. I have distilled the problem down to a simple form drawing data from the Northwind database for a representative...
3
2279
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 than the key value that are stored in the table. It works well if the comboboxes are selected when the row is created.
5
1819
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 label or text box to display the current field value then add a combo box with the list of items to chose from? -- Dennis in Houston
0
1157
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 of SQL Server stored procedures. Basically, for each data entity, I've written _Get(), _Delete(), _Add() and _Update() stored procedures. The _Get() procs return all data needed to display the information in a meaningful manner to the user...
3
3546
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 source for my form tblExpenses. In this table there are three relevant fields . On the form the field is set up as a combobox to get
5
12655
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 need to create single line combobox style control which: 1. Allows to type first characters in name 2. Auto-completes entered data by using first match 3. Allows to open picklist based by entered data and select name
0
8372
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
8475
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
8591
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...
0
7304
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
6160
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
4149
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4293
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1915
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1592
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.