1
Reply

Database Class to read SQL and Access Databases

Darren Formosa

Darren Formosa

Oct 29 2008 12:35 PM
3.7k

Can anybody help with this problem?

I am writing a database class that allow the user to supply database connection and command information to it.  The query I have is that I want it to work with both SQL and Access and would like to avoid using different coding routines for both as they predominently do the same thing hence:

SQL                                                                    Access

SqlConnection mySQL;                                       OdbcConnection myODBC;

mySQL = new SQLConnection(connection);        myODBC = new OdbcConnection (connection);

mySQL.Open()                                                    myODBC.Open();

and so on...

Is it possible to define myDB as say a base object of some description and then set it to either SQL or ODBC when it recognizes the format of the connection string?

Thanks in advance


Answers (1)