Thursday, December 29, 2005 2:55:58 PM UTC :: Filed Under ASP.NET

Note to self:  Do not add a reference to the assembly System.Data.SqlClient in a VisualStudio.NET 2005 project, it is only necessary to have a reference to System.Data.  If you reference both assemblies, you get this error in VisualStudio:

'SqlConnection' is ambiguous in the namespace 'System.Data.SqlClient'.

Why does this happen? According to Kevin Yu’s response in the Google microsoft.public.dotnet.framework newsgroup:

“The System.Data.SqlClient assembly under the PublicAssemblies is used by VS.NET IDE internally. It is a party of the IDE and only the product team knows the difference between this and the one under GAC.

This System.DataSqlClient is not intended to be called from the user code. Usage of this assembly is not supported and might lead to unexpected results.

So if you need to connect to SQL Server in your code. Please reference the System.Data assembly under GAC as MSDN refers to. It includes the namespace of System.Data.SqlClient.”

Comments are closed.
Navigation
On this page....
Search
Archives
<March 2010>
SunMonTueWedThuFriSat
28123456
78910111213
14151617181920
21222324252627
28293031123
45678910
Categories
Contact me
Send mail to the author(s) Contact Todd M. Taylor