将list集合转化为sql in 的范围对象
比如
List<string> idList= new List<string>();
idList.Add("001");
idList.Add("002");
idList.Add("003");
select * from table where id in ('001','002','001')
/// <summary>
/// 将list集合转化为sql in 的范围对象
/// </summary>
/// <param name="guidList"></param>
/// <returns></returns>
public static string transGuidListToSqlString(List<string> guidList)
{
StringBuilder sqlString = new StringBuilder();
foreach (string item in guidList)
{
sqlString.AppendFormat("'{0}',", item);
}
string result = sqlString.ToString();
return result.Trim(',');
}