帮助中有个函数
GetOrderID函数代码为:
Static Lastbh As
String
'通过这个Static变量可以访问上一次生成的编号,避免重复Compute
Dim prefix As
String = Format(Date.now,"yyMMdd") '本次编号前缀
If Lastbh >""
AndAlso Lastbh.SubString(0,6) = prefix Then
'如果上一次生成编号的前缀和本次相同
Lastbh = prefix
& Format(Cint(Lastbh.SubString(6,3)) + 1,"000") '在上次编号的基础上递增1
Else
'取数据表中同前缀的最大编号
Dim max As
String=DataTables("订单").SQLCompute("Max(订单编号)","订单编号 like
'" & prefix & "%'")
If
max = ""
Then
'如果不存在同前缀的编号
Lastbh = prefix
& "001"
'同前缀的第一个编号
Else
Lastbh = prefix
& Format(CInt(max.SubString(6,3)) + 1,"000") '在同前缀最大编号的基础上递增1
End
If
End
If
Return
Lastbh
是获取人为编码的ID,那自增列的ID要如何获取呢?