PC Review


Reply
Thread Tools Rate Thread

Complicated Data Binding Question

 
 
me@nowhere.com
Guest
Posts: n/a
 
      3rd Jul 2005
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 updated with the appropriate name. You can make
modifications to the name and have them updated in the listbox.

This works just fine. Now for the problem.

I need to have the second listbox populated with entries that are
specific to the person that is selected in the first listbox. This
restriction prevents me from directly binding to the Address
DataTable. Once I have the filtered data , I will then need to have
the same editing capabilities as listed above.

Ideally, I would like to do databinding as I will be writing the
values back into the database. I'm just not sure how to filter and
bind at the same time.

If you have a code example somewhere or just a basic "here's what you
need to do" list or any thoughts on how to accomplish this, I would
love to hear about it.

Thanks,
Dave


+--------------+ +--------------+ +--------------+
| Person | | Person2Addr | | Address |
+--+-----------+ +--+-----------+ +--+-----------+
|PK| ID |>---|PK| PersonID |---<|PK| ID |
| | LastName | |PK| AddressID | | | City |
| | FirstName | +--+-----------+ | | State |
+--+-----------+ +--+-----------+



+-----------------------------------------------------------+
| +------------+ +------------+------------------------+ |
| | Listbox | | First Name:| Jane | |
| +------------+ +------------+------------------------+ |
| | Smith,Jane | | Last Name: | Smith | |
| | Smith,John | +------------+------------------------+ |
| +------------+ |
| |
| +--------------+ +--------+----------------------------+ |
| | Listbox | | City: | St. Louis | |
| +--------------+ +--------+----------------------------+ |
| | St.Louis, MO | | State: | MO | |
| | Raleigh, NC | +--------+----------------------------+ |
| +--------------+ |
+-----------------------------------------------------------+

 
Reply With Quote
 
 
 
 
Cor Ligthert
Guest
Posts: n/a
 
      3rd Jul 2005
Me,

You can in my opinion use two approaches (I only declare the second)
You can set a relation, however the most simple one in my opinion is to set
in the index change event the datasource of your second listbox to a
defaultview (dataview) with a rowfilter.

Be aware that you have to protect that event at loading time from taking
action.

Altough, if I understand your well, than I would take a datagrid and not a
listbox for the second. From that datagrid you can using the defaultview
(dataview) remove a lot of editing possibilities and you can remove as well
as the so called left header. With what the datagrid becomes a kind of
multicolumn editable listbox.

I hope this gives an idea, otherwise reply?

Cor


 
Reply With Quote
 
Dave Elliott
Guest
Posts: n/a
 
      4th Jul 2005
I don't see how using a datafilter will get me there.

If "Jane Smith" has 20 addresses in the address table, there would be
20 entries in the person2addr table as well.

I would have to lookup in the person2addr table for all the AddressIDs
that match the ID of "Jane Smith". From there I would have to create
the filter using the 20 AddressIDs that were returned. I'm not sure
that is feasible.

If I am missing something please let me know.

Thanks,
Dave

On Sun, 3 Jul 2005 10:54:45 +0200, "Cor Ligthert"
<(E-Mail Removed)> wrote:

>Me,
>
>You can in my opinion use two approaches (I only declare the second)
>You can set a relation, however the most simple one in my opinion is to set
>in the index change event the datasource of your second listbox to a
>defaultview (dataview) with a rowfilter.
>
>Be aware that you have to protect that event at loading time from taking
>action.
>
>Altough, if I understand your well, than I would take a datagrid and not a
>listbox for the second. From that datagrid you can using the defaultview
>(dataview) remove a lot of editing possibilities and you can remove as well
>as the so called left header. With what the datagrid becomes a kind of
>multicolumn editable listbox.
>
>I hope this gives an idea, otherwise reply?
>
>Cor
>


 
Reply With Quote
 
Cor Ligthert
Guest
Posts: n/a
 
      4th Jul 2005
Dave,

> If "Jane Smith" has 20 addresses in the address table, there would be
> 20 entries in the person2addr table as well.
>


From your first message I did not understand that you not are using a
primary key. If that is the fact, how do you than want to handle that
problem as you describe above?

Cor


 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Complicated report question! Summaring data. Adam Ross Microsoft Access Queries 1 1st Dec 2008 12:58 PM
Complicated report question! Summaring data. Adam Ross Microsoft Access Queries 0 1st Dec 2008 12:11 PM
Complicated ODBC data refresh question. JDNETTC Microsoft Excel Misc 6 30th Jan 2008 11:36 PM
simple structure question with complicated data[x-post from design =?Utf-8?B?SmFuaXM=?= Microsoft Access Getting Started 15 1st Aug 2007 08:48 PM
Complicated Data Binding Question Dave Elliott Microsoft Dot NET Framework Forms 3 28th Sep 2005 08:56 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 03:19 PM.