28,391
社区成员
发帖
与我相关
我的任务
分享
dim rno'定义单据名称
set mm=server.CreateObject("adodb.recordset")
sql="select max(rec_no) as rec_no from to_depot where rec_no left(rec_no,8)=convert(varchar(8),getdate(),112)"--查询数据库中今天最大的编号
mm.open sql,conn,1,1
if mm("rec_no")<>""then
rid=mm("rec_no")
rid=Right(rid, 4)
else
rid=0000
end if
str=""
yno=cstr(year(date))
mno=cstr(month(date))
if len(mno)<2 then
mno="0"&mno
end if
dno=cstr(day(date))
if len(dno)<2 then dno="0"&dno
For i = 1 To 4 - Len(Trim(cint(rid) + 1))
str = str & "0"
Next
rno=yno&mno&dno& str & Trim(cint(rid) + 1)