我在做一个自动生成编号的代码,其中用到了 do while...loop 语句,但在循环里面重复了外面的一段代码,是否可以有类似 do...while loop这样的语句来改进这段代码呢?
e.DataRow("日期")=Date.Today()
Dim d As Date
d=Date.Today()
Dim i As Integer
i=1
Dim bh As String
bh="bh"+Format(d,"yyyyMMdd")+Format(i,"000")
Dim filter As String
filter="编号='"+bh+"'"
Dim dr As DataRow
dr=DataTables("测试表").find(filter)
Do While dr IsNot Nothing
i=i+1
bh="bh"+Format(d,"yyyyMMdd")+Format(i,"000")
filter="编号='"+bh+"'"
dr=DataTables("测试表").find(filter)
Loop
e.DataRow("编号")=bh
[此贴子已经被作者于2014-9-16 8:30:28编辑过]