Kode pada General Declaration Private conn As ADODB.Connection Private oRs As New ADODB.Recordset Kode pada Form Load Private Sub Form_Load() Set conn = New ADODB.Connection conn.Open "Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=Pegawai;Data Source=." s = "SELECT * FROM Absen" oRs.Open s, conn, adOpenKeyset, adLockOptimistic End Sub Kode pada Tombol Simpan Private Sub cmdSimpan_Click() s = "INSERT INTO Absen VALUES('" & txtNIK.Text & "','" & txtNama.Text & "','" & txtSakit.Text & "','" s = s & txtIzin.Text & "','" & txtAbsen.Text & "')" conn.Execute s End Sub Kode pada Tombol Update Private Sub cmdUpdate_Click() oRs.Fields("NIK") = txtNIK.Text oRs.Fields("Nama") = txtNama.Text oRs.Fields("Sakit") = txtSakit.Text oRs.Fields("Izin") = txtIzin.Text oRs.Fields("Absen") = txtAbsen.Text oRs.Update End Sub Kode pada Sub Procedure Baca Data Private Sub BacaData() txtNIK.Text = oRs.Fields("NIK") txtNama.Text = oRs.Fields("Nama") txtSakit.Text = oRs.Fields("Sakit") txtIzin.Text = oRs.Fields("Izin") txtAbsen.Text = oRs.Fields("Absen") End Sub Kode pada Tombol Akhir [<<] Private Sub cmdAwal_Click() oRs.MoveFirst BacaData End Sub Kode pada Tombol Akhir [>>] Private Sub cmdAkhir_Click() oRs.MoveLast BacaData End Sub Kode pada Tombol Lanjut [>] Private Sub cmdLanjut_Click() oRs.MoveNext If oRs.EOF Then oRs.MoveLast BacaData End Sub Kode pada Tombol Sebelumnya [<] Private Sub cmdSebelumnya_Click() oRs.MovePrevious If oRs.BOF Then oRs.MoveFirst BacaData End Sub Kode pada Tombol Cari Private Sub cmdCari_Click() snik = InputBox("NIK:") oRs.MoveFirst oRs.Find "NIK='" & snik & "'" BacaData End Sub Kode pada Tombol Hapus Private Sub cmdHapus_Click() oRs.Delete End Sub Kode pada Tombol Tutup Private Sub cmdTutup_Click() End End Sub Kode pada Form Terminate Private Sub Form_Terminate() conn.Close Set conn = Nothing oRs.Close Set oRs = Nothing End Sub Download project tutorial ini disini : |
Download Football Manager 2012 Full Rip
12 tahun yang lalu
0 komentar:
Posting Komentar