SqlConnection exists in both System.Data.dll and System.Data.SqlClient.dll

  • Thread starter Thread starter YodaJ007
  • Start date Start date
Y

YodaJ007

Can anyone point me in the right direction here? I'm attempting to
compile a Windows project that consists of a single form at this
time. It's a newly generated windows project with a few controls.
Here is the compile 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'


Here is the code. I've just added a few references and the private
field. I've also added references to System.Data and
System.Data.SqlClient to the project. Can anyone tell me why it won't
compile, and how to fix it? I'm at a loss.

using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Data.SqlClient;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Xml;

namespace myproject
{
public partial class Form1 : Form
{
private System.Data.SqlClient.SqlConnection _dbconn;
public Form1()
{
InitializeComponent();
}
}
}
 
Can anyone point me in the right direction here? I'm attempting to
compile a Windows project that consists of a single form at this
time. It's a newly generated windows project with a few controls.
Here is the compile 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'

Why are you referencing the later?
 
Back
Top