1
Answer

compiler error cso433

Ask a question
ray dona

ray dona

16y
5.8k
1

I have written the following code:

using System.Data;

using System.Data.SqlClient;

private void Form1_Load(object sender, EventArgs e)

{//create persistent connection

SqlConnection myConn = new SqlConnection();

DialogResult dr;

dr = dlgOpen.ShowDialog();

if (dr == DialogResult.OK)

{ string strFile = dlgOpen.FileName;

myConn.ConnectionString = "Provider=" +

"Microsoft SQL Server=" + strFile +

";";

//open connection

myConn.Open();

//create command

SqlCommand myCMD = new SqlCommand();

myCMD.CommandText = "SELECT CustomerID, " +

"ContactTitle, CompanyName, ContactName " +

"FROM Customers";

//linking command to connection

.................

}

}

I get the following errors:

Compiler Error CS0433 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'

Compiler Error CS0433 The type 'System.Data.SqlClient.SqlCommand' 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'

I would be grateful if somebody could point out what I am doing wrong, and how I can rectify the mistakes.


Answers (1)