请帮我修改一下我的自动编号代码,看看是哪里出了错,马上给分,在线等!
症状:只能获得象20030927这样的编号
而我的目的是要获取20030927000,20030927001.......这样的自动编号
<%
'取时间作为开台编号,自动+1
dim a,b,c,num,count,three,tableindex,temp,max
a=right(year(date()),2)
i=month(date())
i=Cstr(i)
select case i
case "1" b="01"
case "2" b="02"
case "3" b="03"
case "4" b="04"
case "5" b="05"
case "6" b="06"
case "7" b="07"
case "8" b="08"
case "9" b="09"
case else
b=month(date())
end select
j=day(date())
j=Cstr(j)
select case j
case "1" c="01"
case "2" c="02"
case "3" c="03"
case "4" c="04"
case "5" c="05"
case "6" c="06"
case "7" c="07"
case "8" c="08"
case "9" c="09"
case else
c=day(date())
end select
num="20"&a&b&c
three=1000
set rs_autonum=server.createobject("adodb.recordset")
sql_autonum="select tableindex from t_orderdish where left(tableindex,8)='"&num&"'"
rs_autonum.open sql_autonum,conn,1,1
count=rs_autonum.recordcount
if count=0 then
three=three+count
three=right(Cstr(three),3)
tableindex=num&max
else
max=0
while not rs_autonum.eof
temp=right(rs_autonum("tableindex"),3)
temp=Cint(temp)
if temp>max then max=temp
rs_autonum.movenext
wend
max=1000+max+1
max=right(Cstr(max),3)
tableindex=num&max
end if
%>