Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Join or relate vfp tables prior to putting in dataset
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
ASP.NET
OS:
Windows 7
Database:
Visual FoxPro
Application:
Web
Miscellaneous
Thread ID:
01452459
Message ID:
01452635
Views:
23
>>Neil,
>>
>>>HI,
>>>
>>>Would someone please show me how to perform a vfp datatable query, via a business object function (C# please), that relates two tables prior to putting the result of the query in the dataset.
>>>
>>>I have an appointments data table and a patients data table. The appointments table is small with PK = ID, FK=patientID. The patient data table is huge with PK=patientID.
>>>
>>>Sure, I can bring over the 2 tables and then do the join in the dataset or set up a relation once in the dataset is filled with the 2 tables. But.... I would like to limit the size of the patient table query. This seems so simple in native VFP (set relation to or a select with join) but I am having trouble wrapping my mind around it in MM.NET.
>>>
>>>Thanx,
>>>Neil Gorin
>>
>>I don't have any examples of this to provide you but you do not have to retrieve all the data in order to have relational data. You should be able to retrieve your appointment data and then retrieve the related patient data. If you retrieve this data already joined as in a query you will likely run into problems if you want to update this.
>>
>>The recommended way would be to retrieve your appointment data and then retrieve the related patient in a seperate business object. That said, since I don't know what you are trying to achieve I can't say I am giving you good advice or if it is valid for your situation.
>>Tim
>Just to add a bit to Tim's advice. If you want to bring over one dataset with both patient and appointment data, it shouldn't be a problem to update only the appointment biz object. I have a few tables where I want to show a patient name along with other child data. I just include the name data as part of the dataset but the save only picks up the columns for the child biz object. I don't think you could do updates to the parent table this way without causing problems because you would have duplicate keys.

I can see how the update could a bit more more of a challenge. My appointment bizobj has a method that brings over the appointment data via a SELECT statement that only allows 3 months worth of appointments to populate the dataset. In this way the appointment data is limited down to as small as we can get it. The appointment table has an FK = patientID. I would like to use patientID in the patient datatable to gain access to the patient's name and phone number. So how do I set up a relation between appointments and patients that would allow me to query data and get it all into one dataset - rather than 2 tables in the dataset that first need to be related in the dataset. Anyone have an example?
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform