62,268
社区成员
发帖
与我相关
我的任务
分享select * from test where code in
('1','10','104','108','109','11','110','112','12','122') string code = "1,10,11,104";
string sqlStr = string.Format("select * from test where code in ({0})", Regex.Replace(code, @"[^,]+", "'$0'"));
Response.Write(sqlStr);
System.Text.StringBuilder sb = new System.Text.StringBuilder();
foreach(int c in code)
{
sb.AppendFormat("'{0}',", c);
}
sb.Remove(sb.Length-1);
string condition = sb.ToString();