有人能告诉我如何解决这个错误吗?
SqlCommand cmd = new SqlCommand(sqlCmd, conn)
--> conn: Aurgument type 'System.Data.OleDb.OleDbConnection' is not assignable to parameter type 'System.Data.SqlClient.SqlConnection'.
private void Form1_Load(object sender, EventArgs e)
{
string connString = "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=C:\\Users\\KevinDW\\Desktop\\dotNET\\Week 5\\Prak1\\demo1.accdb";
OleDbConnection conn = new OleDbConnection(connString);
conn.Open();
string sqlCmd = "SELECT CursusNaam FROM tblCursus";
SqlCommand cmd = new SqlCommand(sqlCmd, conn);
using (SqlDataReader reader = cmd.ExecuteReader())
{
listBox1.Items.Add(reader);
}
conn.Close();
}
}