public static string GetSqlList(IEnumerable list)
{
StringBuilder sb = new StringBuilder();
foreach (T item in list)
{
if (item != null && item.ToString() != "")
{
if (sb.Length != 0)
sb.Append(", ");
sb.Append("'");
sb.Append(item.ToString().Replace("'", "''"));
sb.Append("'");
}
}
return sb.ToString();
}
11500cookie-checkC# Building an SQL list