I'm sorry I wasn't clear when I said specific database I meant
database engine. ADO.NET simplifies writing code that works with
MSSQL, MSAccess, Oracle, and any other database engine with an ADO.NET
provider.
A more generic example would be
ConnectionStringSettings info =
ConfigurationManager.ConnectionStrings["mydb"];
DbProviderFactory factory =
DbProviderFactories.GetFactory(info.ProviderName)
DbConnection cnn = factory.CreateConnection();
cnn.ConnectionString = info.ConnectionString;
The key point is that if you switch from MSSQL to Oracle or even from
MSSQL to MSSQL with a 3rd party provider (there are some) then you
don't have to change your code, just your config.
Doesn't help you if you have dbms-specific sql, but it's a good start.
HTH,
Sam
------------------------------------------------------------
We're hiring! B-Line Medical is seeking .NET
Developers for exciting positions in medical product
development in MD/DC. Work with a variety of technologies
in a relaxed team environment. See ads on Dice.com.
On Fri, 03 Aug 2007 18:37:01 -0000,
rl********@gmail.com wrote:
>Samuel, I don't understand how the first method is not tied to a
specific database if in both cases you can specify a connection name.
Can you give an example?
One more thing: if I wanted to use a more generic method called
GetDBConnection() what would be the best approach? I ask that because
they use the same string parameter.
Rod