Protected Sub autoid()
Dim dv As DataView
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 "
',tb_durStf_ann
dv = ObjDb.GetDataSet(sqlTmp).Tables(0).DefaultView
If dv.Count > 0 Then
Dim newID As Integer = CInt(dv.Table.Rows(0)(0).ToString().Substring(1))
newID += 1
MessageBox.Show(newID)
txtdurStf_ann_id.Text = yyyy & "/" & mm & "-" & newID.ToString("0000")
Else
txtdurStf_ann_id.Text = yyyy & "/" & mm & "-" & "0001"
End If
End Sub
Protected Sub autoid()
Dim dv As DataView
Dim sqlTmp As String
Dim yyyy As String = CStr(Now.Year + 43)
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)("durStf_ann_id").ToString().Substring(1))
newID += 1
MsgBox(newID)
txtdurStf_ann_id.Text = yyyy & "/" & mm & "-" & newID.ToString("000")
Else
txtdurStf_ann_id.Text = yyyy & "/" & mm & "-" & "0001"
End If
End Sub
Protected Sub autoid()
Dim dv As DataView
Dim sum As Integer
Dim sqlTmp As String
Dim yyyy As String = CStr(Now.Year + 43)
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)("durStf_ann_id").ToString().Substring(1))
sum = newID + 1
MsgBox(sum)
txtdurStf_ann_id.Text = yyyy & "/" & mm & "-" & sum.ToString("000")
Else
txtdurStf_ann_id.Text = yyyy & "/" & mm & "-" & "0001"
End If
End Sub
Protected Sub autoid()
Dim dv As DataView
Dim sum As Integer
Dim sqlTmp As String
Dim yyyy As String = CStr(Now.Year + 43)
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)("durStf_ann_id").ToString().Substring(0))
sum = newID + 1
'MsgBox(sum)
txtdurStf_ann_id.Text = yyyy & "/" & mm & "-" & sum.ToString("000")
Else
txtdurStf_ann_id.Text = yyyy & "/" & mm & "-" & "0001"
End If
End Sub
Private Sub AuToRunID()
sb.Remove(0, sb.Length)
sb.Append("SELECT TOP 1 id_personnel FROM tb_Personnel order by id_personnel DESC")
Dim sqlSave As String = sb.ToString()
com = New SqlCommand
With com
.CommandType = CommandType.Text
.CommandText = sqlSave
.Parameters.Clear()
.Connection = con
dr = .ExecuteReader()
If dr.HasRows Then
dt = New DataTable
dt.Load(dr)
sum = CInt(dt.Rows(0)("id_personnel").ToString.Substring(2))
autoid = sum + 1
TextBox2.Text = "cd" + autoid.ToString("0000")
Else
TextBox2.Text = "cd0001"
End If
dr.Close()
End With
End Sub
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