protected void DropDownList8_SelectedIndexChanged(object sender, EventArgs e)
{
var connectionString = (ConfigurationManager.ConnectionStrings["Connection"].ConnectionString);
var updateCmd = "UPDATE [CarTab] SET Rent= 1 WHERE ([Model] = @Model)";
using (SqlConnection connection = new SqlConnection(connectionString))
{
SqlCommand command = new SqlCommand(updateCmd, connection);
command.Connection.Open();
command.ExecuteNonQuery();
}
}
错误:必须为 @Model 声明标量变量。我应该在那里删除/添加什么?想不通。提前致谢。