我有一个像这样的多重过滤查询:
我想选中复选框,然后添加到以下查询中:
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>