| 123456789101112131415161718192021222324252627282930313233343536373839 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- namespace Core.Mes.Client.Comm
- {
- public class CoreConverter
- {
- /// <summary>
- /// 生成SQL where条件字符串 "and condition in('args[1],args[2],...')"
- /// </summary>
- /// <param name="column">列名</param>
- /// <param name="args">参数项</param>
- /// <returns></returns>
- public static String toSqlConditionString(String column, String[] args)
- {
- StringBuilder str = new StringBuilder();
- if (args != null && args.Length > 0)
- {
- str.Append(" AND ");
- str.Append(column.ToUpper());
- str.Append(" IN(");
- foreach (String arg in args)
- {
- str.Append("'");
- str.Append(arg);
- str.Append("',");
- }
- str.Remove(str.Length - 1, 1);
- str.Append(")");
- }
- return str.ToString();
- }
-
- }
-
- }
|