Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
Vfp data to sql data using business objects
Message
General information
Forum:
ASP.NET
Category:
The Mere Mortals .NET Framework
Environment versions
Environment:
C# 2.0
OS:
Windows XP SP2
Database:
MS SQL Server
Miscellaneous
Thread ID:
01073189
Message ID:
01073560
Views:
12
Stuart,

>I want to copy some data from some VFP tables to SQL using business objects. both the tables are the same in VFP and SQL. Both business objects work fine in there own projects. When I have both business objects in the same project the both pick up the connections to sql and ignore the vfp tables. How do I get one business object to work with vfp and the other with sql.
>
>I know there are other ways to move the data I just wanted to get to play with MM.

Good to hear from you!

To answer your question, there are two ways you can accomplish this, but this is the most straightforward:

Create two different database entries in your app.config file--one for the SQL Server database and one for the VFP Database. Set the DatabaseKey properties of the business objects accordingly. For example, you might have these two entries:
<databases>
    <add key="NorthwindSQL\Connection" value="server=(local);uid=sa;pwd=;database=Northwind;"/>
    <add key="NorthwindSQL\DataAccessClass" value="DataAccessSql"/>
    <add key="NorthwindVFP\Connection" value="Provider=vfpoledb.1;Data Source=C:\Program Files\Mere Mortals .NET Framework 2003\Samples\VFPData\northwind.dbc"/>
    <add key="NorthwindVFP\DataAccessClass" value="DataAccessOleDb"/>
</databases>
In one business object you can set the DatabaseKey property to "NorthwindSQL" and in the other business object set the DatabaseKey property to "NorthwindVFP".

If you have two databases with identical data structures, another option is to use DatabaseSets. Check out the MM .NET Dev Guide topic "Specifying Database Sets in the Config File".

Regards,

P.S. Here's a link I forgot to send you from class <bg>: http://www.hermanshermits.com.
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