Dawa,
I think you would need two classes. One, a DataAccess class that would handle/determine the commands or Stored Procs that you need to call. And your DataConnection class would handle the connection and the creation/management of either OleDb or Sql Commands and DataAdapters.
So, your Business layer may need to get a Customer. It calls the DataAccess layer's GetCustomer() method, passing the CustomerID and getting a DataSet in return.
The GetCustomer() method of the DataAccess class does all the legwork of determining how to get the data (setting the CustomerID parameter if you're using a Stored Proc, setting the command string to either the Stored Proc name or the SELECT FROM....etc.) and passes the appropriate info to a GetData() method of the DataConnection class, getting a DataSet in return.
The GetData() method of the DataConnection class will then use either OleDb or Sql Commands and DataAdapters, depending on whether it's connecting to VFP or SQL ... which it can determine from the connection string which it reads from the config file. It returns the filled DataSet.
If you're using Typed DataSets, then a CustomerDataSet could be instantiated in your GetCustomer() method and be one of the parameters passed to the GetData() method so that it fills and returns the proper Typed DataSet rather than just a generic DataSet.
This is all very off the top of my head, but it should give you some ideas.
~~Bonnie
>Hi all,
>
>I would like to build a database connection class which will be a layer between the databases and the business logic. I want gradually migrate my VFP database to MSSQL because our clients' info volume is going to exceed VFP's 2g limit in the near future. As part of transition, we'll be using VFP database initially, so the database connection layer will connect to VFP database and later to MSSQL database. What I want to achieve is to make the business logic layer independent of the two databases or dependent of the database connection layer rather as opposed to the two types of databases.
>
>How should I go about constructing such class?