VB
sql = "SELECT * FROM TABLE WHERE AA IN (" '初始化查询字符串
For i = 0 to UBound(Ary) '从0循环到数组最大下标
sql = sql & Ary(i) & "," '将数组中每个值加在查询字符串后面
Next
sql = Left(sql,Len(sql)-1) & ")" '将最后一个逗号换为反括号
C#
sql = "SELECT * FROM TABLE WHERE AA IN (" '初始化查询字符串
For i = 0 to UBound(Ary) '从0循环到数组最大下标
sql = sql & Ary(i) & "," '将数组中每个值加在查询字符串后面
Next
sql = Left(sql,Len(sql)-1) & ")" '将最后一个逗号换为反括号
C#
static void Main(string[] args)
{
string str = "aaaa,bbbb,cccc,dddd,eeee";
string[] condititons = str.Split(',');
string ss = "select * from table where aa in (";
for (int i=0;i<condititons.Length;i++)
{
ss = ss+condititons[i]+",";
}
//sql.Substring(0,sql.Length-1);
//ss = ss.Substring(0,sql.Length-1);
ss = ss.Substring(0,ss.Length-1);
ss = ss +")";
Console.WriteLine(ss);
}
}