当文本框可以输入多个值时,后台需要根据多个值进行查询可以使用in语句,前台进行拼接格式
#region 按周交货标志 string delivy_week_code = this.delivy_week.EditValue.ToString().Trim(); if (delivy_week_code.Length > 0) { string[] str = delivy_week_code.Split(','); for (int i = 0; i < str.Length; i++) { if (i < str.Length - 1) { str_value += "'" + str[i].Trim() + "',"; } else { str_value += "'" + str[i].Trim() + "'"; } } } #endregion
//按周交货标志 if (delivy_week.GetLength() > 0) { sqlwhere += " AND A.DELIVY_WEEK_FLAG IN(" + delivy_week + " )"; }