Minggu, 11 Desember 2011

Pemrograman VB (Part 10)

ADODC
  • Buatlah Form sbb:
    • componen tambahan
      • microsoft ado data control 6.0 (oledb)
      • microsoft data grid control 6.0 (oledb)

setting Adodc1:
  • klik kanan Adodc properti
  • pilih use connection string
  • kemudian Build
  • masukkan database
  • test connection
  • setting Recordsource
  • kemudian apply
sekarang kita masukkan sourcecode
  • klik command button "ADD" masukkan kode source
               Adodc1.Recordset.AddNew
               Text1.SetFocus
  • klik command button "SAVE" masukkan kode source
               Adodc1.Recordset.Update
  • klik command button "DELETE" masukkan kode source
        jwb = MsgBox("Yakin mau dihapus ", vbQuestion + vbYesNo, "Hapus Data")
        If jwb = vbYes Then
        Adodc1.Recordset.Delete
        End If
  • klik command button "CANCEL" masukkan kode source
         Text1.Text = ""
         Text2.Text = ""
         Text3.Text = ""
         Text4.Text = ""
         Combo1.Text = ""
         Text1.SetFocus

sourcecode tambahan
  • (general)    (Declaration)
          Dim mjumlah As Single
  • (general)  (jumlah)
          Private Sub jumlah()
          mjumlah = Adodc1.Recordset.RecordCount
          Text6.Text = mjumlah
          End Sub
  • (datagrid)
         Private Sub DataGrid1_Click()
         Call jumlah
         End Sub

  • Timer
         Private Sub Timer1_Timer()
         Label7 = Date
         Label8 = Time
         End Sub

SELAMAT MENCOBA

Tidak ada komentar:

Posting Komentar