Connect to Database

  • Thread starter Thread starter Ralf La Porte
  • Start date Start date
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
 
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
 
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).
 
Back
Top