Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Saving using Stored Procedures
Message
 
To
03/12/2004 08:29:03
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Miscellaneous
Thread ID:
00965636
Message ID:
00967186
Views:
7
Christian,

>I have another question about these stored procedures.
>I have a form that shows bank information. It has a grid that shows information from two tables, bank and company, using a SQL join to show data in a one-to-one way, so it seems that data comes from only one table. I made a stored procedure that has an update statement for each table. Then, I would have to make a connection object specifically for this type of save, correct? (Since another form would use the company bizobj as well but would not use the same stored procedure to save data).
>
>Then, how can I use the correct connection object? The form would somehow have to specify which connection object to use. I guess I'm a bit confused about how to do this properly. Please help. Thanks.

This typically isn't an issue because the properties of a business object (as represented by the data you retrieve from the back end) should be more static in nature. When you do your object modeling, you need to decide which properties belong to a particular entity. Based on the rules of data normalization there will be places where these properties are physically stored in multiple back end tables. In other cases, you may decide that properties should be broken out into separate entities--for example, you may have an Order business object and an OrderDetail business object which comprise a real-world Order.

I recommend doing your best to specify the properties of a business object and sticking to those as much as possible. This will produce a more predictable object model for your applications and make it easier to perform the mechanics of data retrieval and updating.

That said, if you determine the approach of having multiple sets of data is best in your situation, I recommend specifying a different DataTable for each different set of data. All of the MM .NET business object / data access methods have overloads that accept a DataTable name paramter--so you can retrieve, manipulate, and persist data in multiple DataTables. In the case of the example you mentioned above, if you have different updating requirements, you have a few options:

1. Create a different data access class for each set of data. Based on the DataTable you're working with, you can dynamnically switch out the data access object at run time.

2. Create a single data access class that works with multiple sets of data. This class can determine which DataTable you're working with and execute the appropriate code.

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
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform