Jika Anda ingin membuat kode nomor di aplikasi vb.net secara automatis masukkan kode di bawah ini :
Sub AutoNumber()
Dim strTemp As String
Dim strValue As String
Q = "select * from datasiswa where SUBSTR(nis,6,2)='" & Format(Now, "dd") & Format(Now, "MM") & Format(Now, "yy") & "' order by nis desc"
cmd = New OracleCommand(Q, conn)
read = cmd.ExecuteReader
If read.HasRows Then
read.Read()
strTemp = Mid(read.Item("nis"), 3, 4)
strValue = Val(strTemp) + 1
txtnis.Text = "NI" & Mid("00000", 3, 4 - strValue.Length) & strValue & Format(Now, "dd") & Format(Now, "MM") & Format(Now, "yy")
Else
txtnis.Text = Format(Now, "dd") & Format(Now, "MM") & Format(Now, "yy") & "001"
End If
End Sub
Tuesday, January 17, 2012
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment