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.”