如果是sqlserver数据库,可以用 row_number 函数,参考
http://www.foxtable.com/bbs/dispbbs.asp?BoardID=2&ID=113873&skin=0