问题描述
我们在web.config中使用ASP.NET(框架2),并设置数据库连接字符串(SQL2005)。
We are using ASP.NET (Framework 2) and setting database connection strings (SQL2005) in web.config.
我们目前正在使用的providerName = SqlServer的
我们的所有数据访问使用做了 System.Data.SqlClient的
- 因此我们应该改为的providerName = System.Data.SqlClient的
?我觉得这个的providerName在网络上的例子很多,但很少解释什么的providerName = SqlServer的实际意义。
All our data accesses are done using System.Data.SqlClient
- should we therefore change to providerName=System.Data.SqlClient
? I find many examples of this providerName on the web, but very little explaining what providerName=SqlServer actually means.
时有区别吗?我担心我们目前指定的providerName实际上是引用一个传统(也许更慢)客户端,或者是有一个更有效的客户比的SqlClient与ASP.NET使用?
Is there a difference? I'm worried that the providerName we currently specify is actually referencing a legacy (and maybe slower) client, or is there an even more efficient client than SqlClient for use with ASP.NET?
推荐答案
System.Data.SqlClient的
是SQL Server的.NET Framework数据提供。即.NET库为SQL Server。
System.Data.SqlClient
is the .NET Framework Data Provider for SQL Server. ie .NET library for SQL Server.
我不知道在哪里的providerName = SqlServer的
从何而来。你能收到此混淆与您的连接字符串中的关键字提供商? (我知道我是:))
I don't know where providerName=SqlServer
comes from. Could you be getting this confused with the provider keyword in your connection string? (I know I was :) )
在web.config中你应该有 System.Data.SqlClient的
作为的providerName属性的值。这是您正在使用的.NET Framework数据提供。
In the web.config you should have the System.Data.SqlClient
as the value of the providerName attribute. It is the .NET Framework Data Provider 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>
请参阅
http://msdn.microsoft.com/en-US/library/htw9h4z3(v=VS.80).aspx
这篇关于SQL的providerName在web.config中的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!