views:

258

answers:

2

hi

i try to work with SqlConnection in C# (VS2008) , and i get this error:

The type 'System.Data.SqlClient.SqlConnection' exists in both 'c:\WINDOWS\Microsoft.NET\Framework\v2.0.50727\System.Data.dll' and 'c:\Program Files\Microsoft Visual Studio 8\Common7\IDE\PublicAssemblies\System.Data.SqlClient.dll' D:\test\DBDB\DBDB\Form1.cs 15 9 DBDB

what it can be ?

A: 

Perhaps just drop the reference to System.Data.SqlClient.dll?

Marc Gravell
+1  A: 

The error message is saying that the exact type you wish to use cannot be determined, because there is a System.Data.SqlClient.SqlConnection class available in two assemblies referenced by the project.

You probably want to use the class from System.Data.dll, so consider removing any references to System.Data.SqlClient.dll your project may have, and this problem should disappear.

Programming Hero