Cara Membuat Nomor Otomatis Dengan Format Tanggal [VB.Net]

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..
Komentar →
Comments
1 Comments

1 comments:

Andri mengatakan...

Kalo di vb net gmn ?

Posting Komentar

komentar anda sangat penting utk kemajuan blog ini.trimakasih utk kunjungannya...

◄ Posting Baru Posting Lama ►
 

tourist n stats

W3 Directory - the World Wide Web Directory My Ping in TotalPing.com
Google PageRank Checker Powered by  MyPagerank.Net

guest room

Copyright © 2012. CYBER MANADO - All Rights Reserved B-Seo Versi 3 by Bamz