[QUOTE]Function GetMaxId()
todayDateStr = Year(date()) & Right("00"& Month(date()),2) & Right("00"& Day(date()),2)
strQuery="select top 1 id from test where id like '"& todayDateStr &"%' Order by Id Desc"
set rs=server.createobject("adodb.recordset")
rs.open strQuery,conn,1,1
If Not Rs.Eof Then
NewId = FormatNumber(Rs("Id"),0) + 1
Else
NewId = todayDateStr &"0001"
End If
rs.close()
Set rs = Nothing
GetMaxId = NewId
End Function[/QUOTE]
[此贴子已经被作者于2007-3-28 12:39:53编辑过]