SQL providerName in web.config

We use ASP.NET (Framework 2) and set the database connection strings (SQL2005) in web.config.

We are currently using " providerName=SqlServer ".

All our data calls are performed using System.Data.SqlClient - should we change to providerName=System.Data.SqlClient ? I find many examples of this provider name on the Internet, but I explain very little what providerName = SqlServer really means.

Is there any difference? I'm worried that the provider name we are currently specifying actually refers to the old (and possibly slower) client, or is there an even more efficient client than SqlClient for use with ASP.NET?

+42
sql-server-2005 connection-string
Mar 30 '11 at 9:55
source share
2 answers

System.Data.SqlClient is the .NET Framework data provider for SQL Server. i.e...NET library for SQL Server.

I do not know where providerName=SqlServer comes from. Could you sort out the provider keywords in the connection string? (I know I was :))

In web.config, you must have System.Data.SqlClient as the value of the providerName attribute. This is the .NET Framework data provider that you are using.

 <connectionStrings> <add name="LocalSqlServer" connectionString="data source=.\SQLEXPRESS;Integrated Security=SSPI;AttachDBFilename=|DataDirectory|aspnetdb.mdf;User Instance=true" providerName="System.Data.SqlClient" /> </connectionStrings> 

See http://msdn.microsoft.com/en-US/library/htw9h4z3(v=VS.80).aspx

+84
Mar 30 '11 at 10:29
source share
  WebConfigurationManager.ConnectionStrings["YourConnectionString"].ProviderName; 
0
Jul 14 '17 at 2:42 on
source share



All Articles