ASP生成新会员编号

Function MakeUserCode
    OpenDB()
    Randomize
    dim getid_rs,getid
    set getid_rs=rsobj
    do while true
        getid="CN"&int(rnd()*(10^6))
        getid_rs.open "select * from Members where User_Account='"&getid&"'",con
        if getid_rs.bof or getid_rs.eof then
            getid_rs.close
            exit do
        end if
        getid_rs.close
    loop
    set getid_rs=nothing
    MakeUserCode = getid
    CloseDB()
End Function
原文地址:https://www.cnblogs.com/mssql8/p/3901375.html