生成订单号
每提交一笔数据生成一个订单号(001,002,003......)就这样,sql语句应该怎么写啊
------解决方案--------------------写个函数就可以了!
Function getID()
Dim conn,rs
Dim tempID
Set conn=Server.CreateObject( "ADODB.Connection ")
conn.open conStr '打开数据库
Set rs=conn.Execute( "select max(id) as maxID from [tablename] ")
If rs.Eof Then
getID= "001 "
Else
tempID=CInt(rs( "maxID ")) + 1
If len(tempID)=3 Then
getID=tempID
ElesIf len(tempID)=2 Then
getID= "0 " & tempID
Else
getID= "00 " & tempID
End If
End If
End Function