Re: lookup databinding combobox using stored procedures



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]
- mvp@xxxxxxxxxxxxxxxxxxxxxxxxxxx

"TD is PSP" <TD is PSP@xxxxxxxxxxxxxxxxxxxxxxxxx> wrote in message
news:9C9D6DF1-1368-442E-BA1E-EAB567BAB2C4@xxxxxxxxxxxxxxxx
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.


.



Relevant Pages

  • Re: Crystal reports
    ... > SQL SERVER stored procedures to get the data, and then use Crystal will do ... > the selection criteria box it asks for the date and time and the selection ... > now we are creating DTS packages to read the database, ...
    (microsoft.public.sqlserver.programming)
  • Re: serial numbers
    ... I want to put these items in a drop-down field were users select the item on input, say item "A" needs to be added to the database. ... The other thing also is that on creation of a new record these serial number values do not increase automatically but only for the value linked to the Item selection. ... select the item, use a second field Item_SN to lookup the item serial number from the table containing the unique items. ...
    (comp.databases.filemaker)
  • Wire up a ComboBox.
    ... How do I wire up ComboBox to my data table to store my selection and to my lookup table that allows me to make that selection: ... DataBindings configuration properties of the ComboBox ...
    (microsoft.public.dotnet.framework.windowsforms)
  • Re: BIND: Lookup of CNAME records
    ... > running version 8.3.7-REL of BIND. ... > This setup (actually a replacement for just adding the two nameservers ... > nameservers directly (instead of the local nameserver) solved the ... > CNAME lookup problem. ...
    (freebsd-net)
  • Re: Bind my dataset to combo lookups?
    ... With text fields I can bind them no problems, ... But with the combos, the value ... "Morten Wennevik" wrote: ... full of lookup descriptions. ...
    (microsoft.public.dotnet.general)