C # realize the conversion of string string to in followed by parameters in SQL statement

Time:2021-4-22

After converting string string to in, you can use parameter code:

public string StringToList(string aa)
  {
    string bb1 = "(";
    if (!string.IsNullOrEmpty(aa.Trim()))
    {
      
      string[] bb = aa.Split(new string[] { "\r\n", ",", ";", "* " }, StringSplitOptions.RemoveEmptyEntries);
      for (int i = 0; i < bb.Length; i++)
      {
        If (! BB1. Contains (BB [i])) // remove duplicate input values
        {
          bb1 += "'" + bb[i] + "',";
        }
      }
    }
    bb1 = bb1.Substring(0, bb1.LastIndexOf(",")) + ")";
    return bb1;
  }

With the rapid development of technology, as time goes on, we can not guarantee the correctness of all the contents of this blog. If you have any questions and supplements, you can contact Xiaobian.

Recommended Today

Performance test after class notes (1) basic concepts of performance test

I. real meaning and work content of performance test At first, I thought that performance testing was justDo some scripting, parameterization, correlation, press it up, and then throw a result. But in fact, not only these contents, but alsoPerformance analysis focuses on the improvement of response time, TPS and resource savings after tuning The direction […]