Connect to Database

R

Ralf La Porte

Hello!

What is the best way to connect to a Database (Ado.Net,
Odbc.Net). My prorgram must connect to different Databases
(for example: Oracle, xBase, SQL-Server). The connect to
the database differs from user to user.....

Thanks for your answer and bye

Ralf
 
J

Javier Ros

hi Ralf,
AdoDotNet, of course, my programs connect to differents databases depends
of the day of week and with Ado.Net is easy.
I´m using differents .NET Data Providers but in the service level y work
with Interfaces (IDbConnection, IDbCommand, IDbTransaction, ...)

good lucking.

Javier Ros
 
J

Jimmy [Used-Disks]

Ralf La Porte said:
Hello!

What is the best way to connect to a Database (Ado.Net,
Odbc.Net). My prorgram must connect to different Databases
(for example: Oracle, xBase, SQL-Server). The connect to
the database differs from user to user.....

I use a factory pattern to do this. To do this I read the connection string
from my App.config file then use that to determine the type of database the
connection string is for, I then use that information to create the proper
objects (for example SqlCommand & SqlConnection instead of OdbcCommand &
OracleConnection). To return the result, do as Javier suggested - use the
ADO.NET interfaces (IDbConnection, IDbCommand, etcetera).
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top