java中:

c#中:

1.拼接字符串 sql语句中 in()

str="'001','002','003'";
至于产生string就这样  
str1="'001'";
str2="'002'";
str3="'003'";
str=str1+","+str2+","+str3

StringBuilder idlist = new StringBuilder();
for (int i = 0; i < length; i++)
{
    idlist.Append("'");//添加引号
     idlist.Append( 主键值);// 添加主键
     idlist.Append("',");//添加引号和逗号
}
idlist = idlist.Remove(idlist.Length - 1, 1);//去除最后一个逗号

  

04-13 18:06