01.
Private
Sub
Runnumber()
02.
Dim
MaxID
As
Double
03.
Con.Open()
04.
Cmd =
New
SqlCommand()
05.
With
Cmd
06.
.Connection = Con
07.
.CommandText =
"SELECT MAX (Right(goodsID,3)) FROM GoodsReceive"
08.
If
IsDBNull(.ExecuteScalar()) =
True
Then
09.
MaxID = 1
10.
Else
11.
MaxID = .ExecuteScalar() + 1
12.
End
If
13.
txtautonum.Text = MaxID.ToString(
"000"
)
14.
End
With
15.
Con.Close()