rs.open "select * from 表",cn,3,3 if not rs.eof then rs.movenext 此时的记录指针为最后一条记录
把你的记录倒序排一下就可以啦 rs.open "select * from 表 order by fid desc",cn...... 取第一条记录就是你的最后一条记录了。
if rs.state=adstateopen then rs.close rs.open "select * from tablename",adopenkeyset,adlockreadonly if rs.recordcount>0 then rs.movelast end if'或 rs.open "select max(字段) from tablename",adopenkeyset,adlockreadonly
strSql="SELECT TOP 1 FROM YourTable ORDER BY MainID DESC"
Dim rstLoad As ADODB.RecordSet Dim strSql As String strSql="SELECT * FROM TableName" Set rstLoad=New ADODB.RecordSet rstLoad.Open strSql,gConn,adopenkeyset,adlockreadonly If Not rstLoad.EOF Then rstLoad.MoveLast 'Do what you want... End If
if not rs.eof then rs.movenext
此时的记录指针为最后一条记录
rs.open "select * from 表 order by fid desc",cn......
取第一条记录就是你的最后一条记录了。
rs.open "select * from tablename",adopenkeyset,adlockreadonly
if rs.recordcount>0 then
rs.movelast
end if'或
rs.open "select max(字段) from tablename",adopenkeyset,adlockreadonly
Dim strSql As String
strSql="SELECT * FROM TableName"
Set rstLoad=New ADODB.RecordSet
rstLoad.Open strSql,gConn,adopenkeyset,adlockreadonly
If Not rstLoad.EOF Then
rstLoad.MoveLast
'Do what you want...
End If