流水号问题 ?只能到0002 为什么呢? <%
Function Get_NewId()
dim today : today = date()
dim toyear : toyear = year(today)*10000
dim tomonth : tomonth = month(today)*100
dim tonow : tonow = day(today)
Get_NewId = toyear + tomonth + tonow
sqlstr = "Select ListID from paylist where left(ListID,8)='" & Get_NewId & "'"
Set rs = Conn.Execute(sqlstr)
If rs.EOF Then
Get_NewId = Get_NewId*10000+1
Else
Get_NewId = rs("listid")*1+1
End If
End Function
%> ------解决方案-------------------- 把 sqlstr = "Select ListID from paylist where left(ListID,8)='" & Get_NewId & "'"
改为
sqlstr = "Select MAX(ListID) AS ListID from paylist where left(ListID,8)='" & Get_NewId & "'"