jadi coding ini buat nampilin nomor otomatis dengan format tanggal/bulan/tahunn+nomor urut..
gimana codingnya di vb.net ??
neh..
------------------------------------------------------------------
Shared Function NomorBaru() As String
Dim intValue As Integer = 1
Dim Nota As String = Date.Now.ToString("ddMMyy")
Dim rValue As String
Using objConnection As New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & Application.StartupPath + "\Master.mdb ; " & "User Id=admin;")
objConnection.Open()
Dim objCommand As OleDb.OleDbCommand = objConnection.CreateCommand()
objCommand.CommandText = String.Format("SELECT NoService FROM [SO] WHERE NoService LIKE'{0}###' ORDER BY NoService DESC", Nota)
Dim objValue As Object = objCommand.ExecuteScalar()
If objValue IsNot Nothing Then
If objValue IsNot DBNull.Value Then
Dim strvalue As String = objValue.ToString().Remove(0, 6)
Integer.TryParse(strvalue, intValue)
intValue += 1
End If
End If
objCommand.Dispose()
End Using
rValue = Nota & intValue.ToString("00#")
Return rValue
End Function
---------------------------------------------------------------------------
ket :
warna Merah : untuk Database Yg Digunakan
warna Hijau : untuk nama Field yg digunakan
warna kuning : untuk Nama tabel yg digunakan
Terima kasih..
mudah2an berguna dah..
Subscribe to:
Post Comments
(
Atom
)
Kalo di vb net gmn ?
ReplyDelete