以文本方式查看主题

-  Foxtable(狐表)  (http://www.foxtable.com/bbs/index.asp)
--  专家坐堂  (http://www.foxtable.com/bbs/list.asp?boardid=2)
----  foxtable可以做一个编码器吗  (http://www.foxtable.com/bbs/dispbbs.asp?boardid=2&id=65586)

--  作者:dancheqiqingwa
--  发布时间:2015/3/18 17:04:00
--  foxtable可以做一个编码器吗
foxtable可以做一个编码器吗,比如零件代码由一个编码器来生成
--  作者:Bin
--  发布时间:2015/3/18 17:05:00
--  
不明白你的意思,你的意思是说生成一个随机不重复编码?
--  作者:有点甜
--  发布时间:2015/3/18 17:39:00
--  

 肯定可以,去编写DataRowAdding事件

 

Dim bh As String="P"
Dim max As String
Dim idx As Integer
max = e.DataTable.Compute("Max(客户编号)","客户编号 like \'" & bh & "%\'")
If max > "" Then \'如果存在最大销售单号
    idx = CInt(max.Substring(bh.Length+1)) + 1 \'获得最大销售单号的后三位顺序号,并加1
Else
    idx = 1 \'否则顺序号等于1
End If
e.DataRow("客户编号") = bh & Format(idx,"00000")