I have two tables in a parent-child relationship. Details on the tables are
as shown below:
Table1
-------
Item_ID (primary key)
Item_Owner (foreign key to Table2)
Table2
-------
Owner_ID (primary key)
Owner_Name
I wish to display, on a form designed for maintenance of the data in Table1,
a combobox which displays owner names (Table2.Owner_Name), but returns as
its bound ValueMember the item owner's ID (Table1.Item_Owner). Can I do
it?
Thanks!
--
Greg Dunn 5 1589
Hi Greg,
AFAIK you can't. Binding is against flat table.
However, I am bit confused.
You want to show parent record name and return the child id?
Didn't you mean to display Owner_Name and return Owner_Id (as it is equeal
to Item_Owner)?
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
"Greg Dunn" <My*****@gregdunn.com> wrote in message
news:SjmEb.424031$ao4.1359279@attbi_s51... I have two tables in a parent-child relationship. Details on the tables
are as shown below:
Table1 ------- Item_ID (primary key) Item_Owner (foreign key to Table2)
Table2 ------- Owner_ID (primary key) Owner_Name
I wish to display, on a form designed for maintenance of the data in
Table1, a combobox which displays owner names (Table2.Owner_Name), but returns as its bound ValueMember the item owner's ID (Table1.Item_Owner). Can I do it?
Thanks!
-- Greg Dunn
> Didn't you mean to display Owner_Name and return Owner_Id (as it is equeal to Item_Owner)?
Since, as you note, the Owner_ID will equal the Item_Owner, it really
doesn't matter which of them is returned. But Table1.Item_Owner is the
column to which I would like the control to be bound.
AFAIK you can't. Binding is against flat table.
I haven't found a way to do it, either. It seems like a nasty limitation,
though, since it forces me a choice among several things, none of which I
want to choose:
1. Foregoing the benefits of data binding in the form, or
2. Not using abstract primary keys, or
3. Denormalizing the database.
--
Greg Dunn
"Miha Markic" <miha at rthand com> wrote in message
news:eo**************@tk2msftngp13.phx.gbl... Hi Greg,
AFAIK you can't. Binding is against flat table. However, I am bit confused. You want to show parent record name and return the child id? Didn't you mean to display Owner_Name and return Owner_Id (as it is equeal to Item_Owner)?
-- Miha Markic - RightHand .NET consulting & development miha at rthand com
"Greg Dunn" <My*****@gregdunn.com> wrote in message news:SjmEb.424031$ao4.1359279@attbi_s51... I have two tables in a parent-child relationship. Details on the tables are as shown below:
Table1 ------- Item_ID (primary key) Item_Owner (foreign key to Table2)
Table2 ------- Owner_ID (primary key) Owner_Name
I wish to display, on a form designed for maintenance of the data in Table1, a combobox which displays owner names (Table2.Owner_Name), but returns
as its bound ValueMember the item owner's ID (Table1.Item_Owner). Can I
do it?
Thanks!
-- Greg Dunn
Hi Greg,
Ah sorry, you are after a lookup, right.
Set ComboBox' ValueMamber and DisplayMember to a column from Table2 and
DataSource to Table2
Go to DataBindings and bind Selected Value to Table1.Item_Owner.
That should enable combobox to act like lookup.
--
Miha Markic - RightHand .NET consulting & development
miha at rthand com
"Greg Dunn" <My*****@gregdunn.com> wrote in message
news:cbnEb.424304$ao4.1359496@attbi_s51... Didn't you mean to display Owner_Name and return Owner_Id (as it is
equeal to Item_Owner)?
Since, as you note, the Owner_ID will equal the Item_Owner, it really doesn't matter which of them is returned. But Table1.Item_Owner is the column to which I would like the control to be bound.
AFAIK you can't. Binding is against flat table.
I haven't found a way to do it, either. It seems like a nasty limitation, though, since it forces me a choice among several things, none of which I want to choose:
1. Foregoing the benefits of data binding in the form, or 2. Not using abstract primary keys, or 3. Denormalizing the database.
-- Greg Dunn
"Miha Markic" <miha at rthand com> wrote in message news:eo**************@tk2msftngp13.phx.gbl... Hi Greg,
AFAIK you can't. Binding is against flat table. However, I am bit confused. You want to show parent record name and return the child id? Didn't you mean to display Owner_Name and return Owner_Id (as it is
equeal to Item_Owner)?
-- Miha Markic - RightHand .NET consulting & development miha at rthand com
"Greg Dunn" <My*****@gregdunn.com> wrote in message news:SjmEb.424031$ao4.1359279@attbi_s51... I have two tables in a parent-child relationship. Details on the
tables are as shown below:
Table1 ------- Item_ID (primary key) Item_Owner (foreign key to Table2)
Table2 ------- Owner_ID (primary key) Owner_Name
I wish to display, on a form designed for maintenance of the data in Table1, a combobox which displays owner names (Table2.Owner_Name), but returns as its bound ValueMember the item owner's ID (Table1.Item_Owner). Can I do it?
Thanks!
-- Greg Dunn
Greg,
You want to fill your Owner table with all the valid vlaues it would be
(complete table scan?) just use a Data Adapter to fill it or whatever you
want.
Then, on your bindings, you want to bind your combo boxes SelectedValue to
your Table1.Item_Owner Property.
This should take care of it.
and on yoru combo box, set your display member to Owner_name and your
valuemember to OwnerID. Thats all it takes.
peace,
cJ
"Greg Dunn" <My*****@gregdunn.com> wrote in message
news:SjmEb.424031$ao4.1359279@attbi_s51... I have two tables in a parent-child relationship. Details on the tables
are as shown below:
Table1 ------- Item_ID (primary key) Item_Owner (foreign key to Table2)
Table2 ------- Owner_ID (primary key) Owner_Name
I wish to display, on a form designed for maintenance of the data in
Table1, a combobox which displays owner names (Table2.Owner_Name), but returns as its bound ValueMember the item owner's ID (Table1.Item_Owner). Can I do it?
Thanks!
-- Greg Dunn
Ah...very easy. Many thanks!
--
Greg Dunn
"Miha Markic" <miha at rthand com> wrote in message
news:%2****************@tk2msftngp13.phx.gbl... Hi Greg,
Ah sorry, you are after a lookup, right. Set ComboBox' ValueMamber and DisplayMember to a column from Table2 and DataSource to Table2 Go to DataBindings and bind Selected Value to Table1.Item_Owner.
That should enable combobox to act like lookup.
-- Miha Markic - RightHand .NET consulting & development miha at rthand com
"Greg Dunn" <My*****@gregdunn.com> wrote in message news:cbnEb.424304$ao4.1359496@attbi_s51... Didn't you mean to display Owner_Name and return Owner_Id (as it is equeal to Item_Owner)?
Since, as you note, the Owner_ID will equal the Item_Owner, it really doesn't matter which of them is returned. But Table1.Item_Owner is the column to which I would like the control to be bound.
AFAIK you can't. Binding is against flat table.
I haven't found a way to do it, either. It seems like a nasty
limitation, though, since it forces me a choice among several things, none of which
I want to choose:
1. Foregoing the benefits of data binding in the form, or 2. Not using abstract primary keys, or 3. Denormalizing the database.
-- Greg Dunn
"Miha Markic" <miha at rthand com> wrote in message news:eo**************@tk2msftngp13.phx.gbl... Hi Greg,
AFAIK you can't. Binding is against flat table. However, I am bit confused. You want to show parent record name and return the child id? Didn't you mean to display Owner_Name and return Owner_Id (as it is equeal to Item_Owner)?
-- Miha Markic - RightHand .NET consulting & development miha at rthand com
"Greg Dunn" <My*****@gregdunn.com> wrote in message news:SjmEb.424031$ao4.1359279@attbi_s51... > I have two tables in a parent-child relationship. Details on the tables are > as shown below: > > Table1 > ------- > Item_ID (primary key) > Item_Owner (foreign key to Table2) > > Table2 > ------- > Owner_ID (primary key) > Owner_Name > > > I wish to display, on a form designed for maintenance of the data in Table1, > a combobox which displays owner names (Table2.Owner_Name), but
returns as > its bound ValueMember the item owner's ID (Table1.Item_Owner). Can
I do > it? > > Thanks! > > -- > Greg Dunn > > >
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Greg Dunn |
last post by:
I have two tables in a parent-child relationship. Details on the tables are
as shown below:
Table1
-------
Item_ID (primary key)
Item_Owner (foreign key to Table2)
Table2
-------
|
by: Paul Slavin |
last post by:
I have a textbox bound to a dataview, when I update the text in the textbox no changes take place in the underlying dataset. Why is this??
any answers appreciated, as to due to the underlying...
|
by: Bruce |
last post by:
Hi, there,
I meet a problem about comboBox binding.
--------------------
Database: Northwind
Tables: 1) Products 2) Categories
I create a form (named "form1") to edit the record from...
|
by: Richard |
last post by:
I have created a form which sets up a dataview. The form views one
record at a time using a currencymanager. This works fine. All my
text boxes bind.
However I have a combo box which gets its...
|
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...
| |
by: oracle |
last post by:
Greetings,
I have a combo box that I binded to a data set using text and tags. I
want it to display the DRT.Name property and have a DRT.UnitId as a
value.
...
|
by: Simon Tamman |
last post by:
I've come across an interesting bug.
I have workarounds but i'd like to know the root of the problem. I've
stripped it down into a short file and hope someone might have an idea about
what's going...
|
by: Max |
last post by:
Hello,
I made a windows form with a combo box and 4 text boxes. All 5 objects should get their data from a data set which is populated
in the form load method. The combo box has item ids. When...
|
by: Jim |
last post by:
Hi,
Trying to implement databinding. I've a dataset with a table, a windows
form with typical controls: combobox, datetimepicker, textbox . . .
I use what I think is a normal method to...
|
by: GS |
last post by:
I am perplexed . I thought it is easy to fix the binding error on
cvtDtFrom. I only used the cvtDtFrom a couple of places but I found out
the error occurred before form loading.
I tried...
|
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,...
| |
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...
|
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...
|
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...
|
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,...
|
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...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |
by: muto222 |
last post by:
How can i add a mobile payment intergratation into php mysql website.
|
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...
| |