- Beranda
- Komunitas
- Tech
- Programmer Forum
tanya vbnet
TS
dhebyaja
tanya vbnet
saya mau tanya nih gan vbnet, kalau mau buat kode otomatis, tapi dengan kondisi setiap ganti bulan kodenya akan berubah ke kode awal lagi dan seterusnya. terima kasih. Untuk bulannya saya pakai datetimepitcher
kodenya begini gan
Sub kodeotomatis()
cmd = New OdbcCommand("select * from ssp order by Kode desc", conn)
dr = cmd.ExecuteReader
dr.Read()
If Not dr.HasRows Then
txtkode.Text = "AG17001"
Else
txtkode.Text = Val(Microsoft.VisualBasic.Mid(dr.Item("Kode").ToString, 5, 3)) + 1
If Len(txtkode.Text) = 1 Then
txtkode.Text = "AG1700" & txtkode.Text & ""
ElseIf Len(txtkode.Text) = 2 Then
txtkode.Text = "AG170" & txtkode.Text & ""
ElseIf Len(txtkode.Text) = 3 Then
txtkode.Text = "AG17" & txtkode.Text & ""
End If
End If
kodenya begini gan
Sub kodeotomatis()
cmd = New OdbcCommand("select * from ssp order by Kode desc", conn)
dr = cmd.ExecuteReader
dr.Read()
If Not dr.HasRows Then
txtkode.Text = "AG17001"
Else
txtkode.Text = Val(Microsoft.VisualBasic.Mid(dr.Item("Kode").ToString, 5, 3)) + 1
If Len(txtkode.Text) = 1 Then
txtkode.Text = "AG1700" & txtkode.Text & ""
ElseIf Len(txtkode.Text) = 2 Then
txtkode.Text = "AG170" & txtkode.Text & ""
ElseIf Len(txtkode.Text) = 3 Then
txtkode.Text = "AG17" & txtkode.Text & ""
End If
End If
nona212 memberi reputasi
1
863
3
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Urutan
Terbaru
Terlama
Tulis komentar menarik atau mention replykgpt untuk ngobrol seru
Komunitas Pilihan