[求助]C#怎么连接SQL 2000
C#怎么连接SQL 2000
我用的是SQL 2005
try
{
SqlConnection conn = new SqlConnection("server=.;pwd = 'sun',user id = 'sa',database = db");
conn.Open();
SqlCommand cmd = new SqlCommand();
= "INSERT INTO test(city,tq,wd) VALUES ('qq','" + YQ + "','" + WD + "')";
cmd.Connection = conn;
cmd.EndExecuteNonQuery();//这里提示错误,应该是数据库连接问题
MessageBox.Show("数据添加成功!");
conn.Close();
}
catch (SqlException E)
{
MessageBox.Show(E.Message);
}