Protected Sub autoid()
Dim dv As DataView
Dim sum As Integer
Dim sqlTmp As String
Dim yyyy As String = CStr(Now.Year + 543)
Dim mm As String = CStr(Now.Month)
sqlTmp = "Select MAX(durStf_ann_id) as durStf_ann_id from tb_mate_durStf_ann1 "
dv = ObjDb.GetDataSet(sqlTmp).Tables(0).DefaultView
If dv.Count > 0 Then
Dim newID As Integer = CInt(dv.Table.Rows(0)(0).ToString().Substring(7))
newID = newID + 1
'MsgBox(sum)
txtdurStf_ann_id.Text = yyyy & "/" & "0" & mm & "-" & newID.ToString("0000")
Else
txtdurStf_ann_id.Text = yyyy & "/" & "0" & mm & "-" & "0001"
End If
End Sub
Date :
2013-01-21 19:20:36
By :
keem
No. 4
Guest
dv = ObjDb.GetDataSet(sqlTmp).Tables(0).DefaultView
คืออะไรครับ อธิบายหน่อย ครับ ูู