我有一个这样的多重过滤器查询:
我想让复选框被选中,然后添加到以下查询中:
var db = Database.Open("RMS") ;
var selectCommand = "SELECT * FROM RMS";
var formSSO = "";
var formCase_Status= "";
var fromDate = "";
var toDate = "";
var SQLSELECT = "SELECT * FROM Admins WHERE Email = @0";
var Email = WebSecurity.CurrentUserName;
var data1 = db.QuerySingle(SQLSELECT, Email);
var Name = data1.Name;
formSSO = Request.QueryString["formSSO"];
formCase_Status = Request["formCase_Status[]"];
fromDate = Request.QueryString["fromDate"];
toDate = Request.QueryString["toDate"];
selectCommand = "SELECT * FROM RMS WHERE Assigned_To = @4";
if(!Request.QueryString["formSSO"].IsEmpty() ) {
selectCommand +=" AND SSO LIKE @0";
}
if(!Request.QueryString["formCase_Status"].IsEmpty() ) {
selectCommand +=" AND Case_Status = @1";
}
if(!Request.QueryString["fromDate"].IsEmpty() ) {
selectCommand +=" AND Created >= @2";
}
if(!Request.QueryString["toDate"].IsEmpty() ) {
selectCommand +=" AND Created <= @3";
}
如果只选择一个复选框,我可以让它工作,但我的主要观点是允许选中多个复选框。我如何使用 JS 或 Jquery 来做到这一点我已经尝试过其他 qts 的答案,但它们与我正在做的事情并不完全一致。我不想要警报,而是一种可以在 select 语句中调用所有检查值的方法。
这是复选框:
<li class="form-line form-line-column" id="id_20">
<label class="form-label-top" id="label_20" for="input_20"> Status </label>
<div id="cid_20" class="form-input-wide">
<input type="checkbox" checked="@(Request["formCase_Status[]"] == "In Progress")" name="formCase_Status[]" value="In Progress"> In Progress<br>
<input type="checkbox" checked="@(Request["formCase_Status[]"] == "Pending")" name="formCase_Status[]" value="Pending"> Pending<br>
<input type="checkbox" checked="@(Request["formCase_Status[]"] == "Closed")" name="formCase_Status[]" value="Closed"> Closed<br>
</div>
</li>