dim str
str=""
sql="select * from table"
rs.open sql,con,1,3
do while (not rs.eof)
str=str & "'" & rs("uid") & "',"
rs.movenext
loop
rs.close
str=left(str,len(str)-1)
这样不就可以啦
效率如何体现呢,
这样也不算慢呀

解决方案 »

  1.   

    这种方法最快:
    con.open "..." '要用SQLOLEDB提供者最快,
    rs.open "select fld from tb",con '其他全部默认。
    do while not rs.eof 
    str= str &"," & rs.fileds(0)
    loop
      

  2.   

    dim strResult as string 
    dim strLine as String 
    sql="select uid from table"
    rs.open sql,con,1,3
    do until rs.eof
        strLine = "'" & rs(0) & "',"
        strResult = strResult & strLine
        rs.movenext
    loop
    rs.close
    if(len(strResult) >0)
       strResult = left(strResult,len(strResult)-1)