我正在使用 VS2010 和 SQL Server 2008 Management Studio
protected void btnsave_click(object sender, EventArgs e)
{
SqlConnection myConnection = new SqlConnection("Data Source=SAAD-CH-HP;Initial Catalog=ovms;Integrated Security=True;");
myConnection.Open();
SqlCommand cmd = new SqlCommand(@"INSERT INTO request(reqtype, source,employeeID, vehID, destination) VALUES ('"
+ official + "','" + source + "','" + emp_id + "','" + DropDownList1 + "','" + destination + "')");
cmd.ExecuteNonQuery();
myConnection.Close();
}
当我运行程序时,会发生此异常
ExecuteNonQuery:连接属性尚未初始化。