Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
There's got to be an easier way to sync two tables
Message
 
À
22/06/2007 12:16:23
Information générale
Forum:
ASP.NET
Catégorie:
The Mere Mortals .NET Framework
Divers
Thread ID:
01235060
Message ID:
01235519
Vues:
15
>I was looking at the example in the manual "Synchronizing Data Bound User Interface Controls" and it seems that this is more code than is needed to sync a control.
>
>I have an Equipment table that has a field, FacilityId (integer), that I want linked to another table, Facilities with an Id (integer) field that is the key field, so that as I navigate the Equipment table, the text box on the form will show the name in the Facility table:
>
>Equipment
> FacilityId --> Facilities.Id
>
>On my form is a text field that is bound to the Name field in the Facilities table.
>
>FacilityName.Text --> Facilities.Name
>
>But I can't get this to work simply.
>
>I have already created a routine when a row's data is 'Retrieved' I save the Id and then use a Select command to get the Facility's name. This too seems like overkill.

If you only want to display the information (read-only) then you can simply change your SELECT so it joins the two tables and retrieves the name from the Facilities table when you retrieve the equipment. If you want to make it editable, you can use a combo box instead. In that case you bind the combo box's value to Equipment.FacilityID and fill the combo box items by retrieving data from the Facilities table.

Best Regards,
Kevin McNeish
Eight-Time .NET MVP
VFP and iOS Author, Speaker & Trainer
Oak Leaf Enterprises, Inc.
Chief Architect, MM Framework
http://www.oakleafsd.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform