我正在尝试使用switch语句来引用下拉列表,以便我可以选择值。真的不知道如何去做。 这是我到目前为止所尝试的:
switch (*******)
{
case "meeting":
var named = Request["name_id"];
var from_where = Request.Form["from_where"];
var sql = "INSERT INTO
person.Name(full_name,email,phone_number,address,signed_in) VALUES
(@0,@1,@2,@3,@4)";
db.Execute(sql, full_name, email, phone_number, address,
DateTime.Now.ToLocalTime());
var col = db.GetLastInsertId();
var query = "insert into
Meeting(name_id,name_of_company,purpose,signed_in)values(@0,@1,@2,@3)";
db.QueryValue(query, col, _name_of_company, _purpose,
DateTime.Now.ToLocalTime());
break;
case "event":
from_where = Request.Form["from_where"];
sql = "INSERT INTO
person.Name(full_name,email,phone_number,address,signed_in) VALUES
(@0,@1,@2,@3,@4)";
db.Execute(sql, full_name, email, phone_number, address,
DateTime.Now.ToLocalTime());
var col1 = db.GetLastInsertId();
var query1 = "insert into Event(name_id, name_of_company, name_of_event,
signed_in)values(@0,@1,@2,@3)";
db.Execute(query1, col1, _name_of_company, _name_of_event, DateTime.Now);
break;
default:
break;
}
this is the HTML
<select class="form-control" name="_purpose" id="inputGroupSelect01">
<option>Please select purpose</option>
<option value="meeting"> Meeting</option>
<option value="event">Event</option>
<option value="pickup"> Pickup/Delivery</option`enter code here`>
</select>