Windows Forms and Relational Data

  • Thread starter Thread starter shimonsim
  • Start date Start date
S

shimonsim

Hi
I have problem with working with normalized data using windows form.
To explain the problem I take an example.
I have Customer that can have few Phone Number - Home, Business, Fax,
Wireless .... So DB have three tables Customer and CustomerPhone PhoneType
that are connected with relations. In web project I would let user add one
phone number per time allowing him to pick Type of Phone number and enter
the number. For Web project would be just fine (this is my opinion)
But for Windows Project it is not 'cool' enough (again it's my opinion).
Usually form should have all or some phone titles shown (just look in MS
Outlook). So it seems to me that Data binding is out and It looks like that
I need to do all the denormalization in code (or just denormalize DB). My
opinion it is a lot of work .
May be someone have seen this problem and has a solution for it.

Thanks,
Shimon
 
Hi,

From my understanding , you want to show all Phone number of a certain
customer on the same form. data-binding on label or textbox might not be
suitable for this case, since they are only able to show the value of
the"Current" record.

In you case, you may try using the datagrid control to show all the phone
numbers at a time.
If this is not an option, as far as I knew, you need write code to
enumerate the coresponding child rows and set the value to the controls.

However, we could still use ADO.NET to organize the data. You may create a
DataTable for the Customer Table, and create another DataTable for the join
result of the PhoneNumber table and PhoneType table. Then we could create a
parent-child relationship between the two tables. You can use the
databinding to show the parent table. and get the corrsponding child rows
by using GetChildRows method on the current row of the parent table.
Of course, you still need write the Insert/Update/Delete command for the
joined result.

If you have any further questions on this issue, please reply be free to
reply this thread.
Thanks!

Best regards,

Ying-Shen Yu [MSFT]
Microsoft Online Partner Support
Get Secure! - www.microsoft.com/security

This posting is provided "AS IS" with no warranties and confers no rights.
This mail should not be replied directly, "online" should be removed before
sending.
 
Back
Top