gpt4 book ai didi

c# - ExecuteNonQuery 结果为 "Connection property has not been initialized."

转载 作者:太空宇宙 更新时间:2023-11-03 13:44:57 25 4
gpt4 key购买 nike

<分区>

我正在使用 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: Connection property has not been initialized.

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com