Kamis, 19 Januari 2012
PROJECT FORM PEGAWAI CLIENT
Dim IPServer As String
Sub Hapus()
Nip.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 Pegawai(Nip,Nama,Jeniskelamin,Jabatan)" & _
"values('" & Nip.Text & _
"','" & Nama.Text & _
"','" & Gol.Text & _
"','" & Jeniskelamin.Text & _
"','" & Jabatan.Text & "')"
Case 1
SQL = "UPDATE Pegawai SET Nama='" & Nama.Text & "'," & _
"Gol= '" & Gol.Text & "'," & _
"Jeniskelamin= '" & Jeniskelamin.Text & "'," & _
"Jabatan= '" & Jabatan.Text & "'," & _
"where Nip='" & Nip.Text & "'"
Case 2
SQL = "DELETE FROM Pewagai WHERE Nip='" & Nip.Text & "'"
End Select
MsgBox "Pemprosesan RECORD Database telah berhasil...!", vbInformation, "Pegawai"
Call Hapus
Nip.SetFocus
End Sub
Private Sub CmdProses_Click(Index As Integer)
Select Case Index
Case 0
Call Hapus
Nip.SetFocus
Case 1
If CmdProses(1).Caption = "&Simpan" Then
SQL = "INSERT INTO Pegawai(Nip,Nama,Gol,Jeniskelamin,Jabatan)" & _
"values('" & Nip.Text & _
"','" & Nama.Text & _
"','" & Gol.Text & _
"','" & Jeniskelamin.Text & _
"','" & Jabatan.Text & "')"
WS.SendData "INSERT-" & SQL
Else
SQL = "UPDATE pegawai set " & _
"nama= '" & Nama.Text & _
"',jabatan='" & Jabatan.Text & _
"' where Nip='" & Nip.Text & "'"
WS.SendData "UPDATE-" & SQL
End If
Case 2
x = MsgBox("Yakin RECORD Pegawai Akan Dihapus...!", vbQuestion + vbYesNo, "Pegawai")
If x = vbYes Then
WS.SendData "DELETE-" & Nip.Text
End If
Call Hapus
Nip.SetFocus
Case 3
Call Hapus
Nip.SetFocus
Case 4
Unload Me
End Select
End Sub
Private Sub Form_Load()
Call Hapus
MulaiKoneksi
End Sub
Private Sub Kode_KeyPress(KeyAscii As Integer)
If KeyAscii = 13 Then
If Nip.Text = "" Then Exit Sub
WS.SendData "SEARCH-" & Nip.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 = Nip.Text
Call Hapus
Kode.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)
Gol.Text = xData2(1)
Jeniskelamin.Text = xData2(2)
Jabatan.Text = xData2(3)
Call RubahCMD(Me, False, True, True, True)
CmdProses(1).Caption = "&Edit"
Nip.Enabled = False
Nama.SetFocus
Case "DEL"
MsgBox "penghapusan data berhasil !"
Call Hapus
Case "EDIT"
MsgBox "pengeditan record berhasil !"
Call Hapus
End Select
End Sub
Langganan:
Posting Komentar (Atom)
Tidak ada komentar:
Posting Komentar