Jassim,
Do you need to connect to a particular database, or do you need to
connect to any database?
If you have a specific database type to connect to, then look to see if
there are managed database providers for that DB. For example, if you want
to connect to Sql Server, then you will want to connect to the classes in
the System.Data.SqlClient namespace.
If you need to connect to any database in a generic way, the standard
classes (data adapters, connections, etc, etc) all implement an interface
(IDbConnection, IDbDataAdapter in .NET 1.1 and before) or derive from a
common base class (DbConnection, DbDataAdapter in .NET 2.0). You can use a
factory pattern to get specific instances of these types, and cast to the
base class/interface. The problem here is that you have to make sure that
the queries that you use across all of the different db providers will work.
Hope this helps.