//用来存储多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(); })));