實現把String字元串轉化為In後可用參數代碼: public string StringToList(string aa) { string bb1 = "("; if (!string.IsNullOrEmpty(aa.Trim())) { string[] bb = aa.Split(new ...
實現把String字元串轉化為In後可用參數代碼:
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]))//去掉重覆的輸入值 { bb1 += "'" + bb[i] + "',"; } } } bb1 = bb1.Substring(0, bb1.LastIndexOf(",")) + ")"; return bb1; }