insertUtil代办

[WebMethod]
public string insertUtil(string param)
{
string result = string.Empty;
StringBuilder sb = new StringBuilder();
string[] paramsArray = param.Split(',');

        sb.Append("SqlParameter sp = new SqlParameter();");

        foreach (var item in paramsArray)
        {
            string s = Regex.Replace(item, "^(string )", "").Trim();

            sb.Append("if (string.IsNullOrWhiteSpace(" + s + ")){");
            // sb.Append(s);
            sb.Append("}");
        }
        result = sb.ToString();
        return result;
    }

猜你喜欢

转载自www.cnblogs.com/wsq-blog/p/10746126.html