SQL 语句 in 查询拼接 C#

 

//用来存储多ID  

List<int> itemids = new List<int>();

 var sql = @"update [Table] WITH (ROWLOCK)

SET

匹配方式 = ‘{0}‘

where ID in({1})";

//string.Join(",", Array.ConvertAll<int, string>(itemids.ToArray(), delegate (int x) { return x.ToString(); }))   查询ID拼接
var newsql = string.Format(sql, item.MatchType, string.Join(",", Array.ConvertAll<int, string>(itemids.ToArray(), delegate (int x) { return x.ToString(); })));

 

SQL 语句 in 查询拼接 C#

上一篇:SqlServer 自增id字段值跳跃


下一篇:阿里云加速器创新时辰“星光奖”成都5家创企上榜