Dim IPServer As String
Sub hapus()
NIDN.Enabled = True
ClearFORM Me
Call RubahCMD(Me, True, False, False, False)
CmdProses(1).Caption = "&Simpan"
End Sub
Sub ProsesDB(Log As Byte)
Select Case Log
Case 0
SQL =
"INSERT INTO Dosen(NIDN, Nama,
Tempat,Tanggal,Pendidikan,Bagian,Status)" & _
"values('" & NIDN.Text & _
"','" & NAMA.Text & _
"','" & TEMPAT.Text & _
"','" & TANGGAL.Text & _
"','" & PENDIDIKAN.Text & _
"','" & BAGIAN.Text & _
"','" & STATUS.Text & "')"
Case 1
SQL = "UPDATE
Dosen SET Nama='" & NAMA.Text & "'," & _
" Tempat
= '" & TEMPAT.Text & "' " & _
" Tanggal
= '" & TANGGAL.Text & "' " & _
"
Pendidikan = '" & PENDIDIKAN.Text & "' " & _
" Bagian
= '" & BAGIAN.Text & "' " & _
" Status
= '" & STATUS.Text & "' " & _
"where
NIDN ='" & NIDN.Text & "'"
Case 2
x =
MsgBox("Yakin RECORD Barang Akan Dihapus...!", vbQuestion + vbYesNo,
"Barang")
If x = vbYes
Then
WS.SendData
"DELETE-" & Kode.Text
End If
Call hapus
Kode.SetFocus
Case 3
Call hapus
Kode.SetFocus
Case 4
Unload Me
End Select
End Sub
Sub tampilDosen()
On Error Resume Next
NIDN.Text = Rs!NIDN
NAMA.Text = Rs!NAMA
TEMPAT.Text = Rs!TEMPAT
TANGGAL.Text = Rs!TANGGAL
PENDIDIKAN.Text = Rs!PENDIDIKAN
BAGIAN.Text = Rs!BAGIAN
STATUS.Text = Rs!STATUS
End Sub
Private Sub CMDproses_click(index As Integer)
Select Case index
Case 0
Call hapus
NIDN.SetFocus
Case 1
If
CmdProses(1).Caption = "&Simpan" Then
Call ProsesDB(0)
Else
Call
ProsesDB(1)
End If
Case 2
x = MsgBox("Yakin
RECORD Dosen Akan Dihapus...!", vbQuestion + vbYesNo, "Dosen")
If x = vbYes Then
ProsesDB 2
Call hapus
NIDN.SetFocus
Case 3
Call hapus
NIDN.SetFocus
Case 5
Adodc1.Refresh
Case 4
Unload Me
End Select
End Sub
Private Sub form_load()
Call hapus
MulaiKoneksi
BAGIAN.AddItem
"HRD"
BAGIAN.AddItem
"Humas"
BAGIAN.AddItem
"Keuangan"
PENDIDIKAN.AddItem
"Diploma III"
PENDIDIKAN.AddItem
"Strata I"
PENDIDIKAN.AddItem
"Strata II"
STATUS.AddItem
"Menikah"
STATUS.AddItem
"Belum MENIKAH"
End Sub
Private Sub NIDN_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If NIDN.Text = "" Then Exit Sub
WS.SendData "SEARCH-" & NIDN.Text
End If
End Sub
Sub MulaiKoneksi()
IPServer = "192.168.10.1"
IPClient = WS.LocalIP
WS.Connect IPServer, 1000
End Sub
Private Sub Form_QueryUnload(Cancel As Integer, UnloadMode
As Integer)
DoEvents
End
End Sub
Private Sub WS_Dataarrival(ByVal bytesTotal As Long)
Dim xkrim As String
Dim xData1() As String
Dim xData2() As String
WS.GetData xKirim, vbString, bytesTotal
xData1 = Split(xKirim, "-")
Select Case xData1(0)
Case "NOTHING"
x = NIDN.Text
Call hapus
NIDN.Text = x
Call RubahCMD(Me, False, True, False, True)
CmdProses(1).Caption = "&Simpan"
NAMA.SetFocus
Case "RECORD"
xData2 = Split(xData1(1), "/")
NAMA.Text = xData2(0)
TEMPAT.Text = xData2(1)
TANGGAL.Text = xData2(2)
PENDIDIKAN.Text = xData2(3)
BAGIAN.Text = xData2(4)
STATUS.Text = xData2(5)
Call RubahCMD(Me, False, True, True, True)
CmdProses(1).Caption = "&Edit"
NIDN.Enabled = False
NAMA.SetFocus
Case "DEL "
MsgBox "penghapusan data berhasil !"
Call hapus
Case "EDIT"
MsgBox "pengeditan record berhasil !"
Call hapus
End Select
End Sub
Tidak ada komentar:
Posting Komentar