Langsung ke konten utama

database pada vb

DATABASE PADA VB
LISTING PROGRAM

Private Sub Command1_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset!NAMA = Text1.Text
Adodc1.Recordset!NPM = Text2.Text
Adodc1.Recordset!KELAS = Text3.Text
DataGrid1.Refresh
If Text1 = "" Or Text2 = "" Or Text3 = "" Then
MsgBox "DATA HARUS DILENGKAPI"
End If
End Sub

Private Sub Command2_Click()
Adodc1.Recordset.Update
Adodc1.Recordset!NAMA = Text1.Text
Adodc1.Recordset!NPM = Text2.Text
Adodc1.Recordset!KELAS = Text3.Text
DataGrid1.Refresh
End Sub

Private Sub Command3_Click()
If Adodc1.Recordset.BOF Then
MsgBox "DATA SUDAH HABIS"
Else
Adodc1.Recordset.Delete
End If
End Sub

Private Sub Command4_Click()
Text1.Text = Clear
Text2.Text = Clear
Text3.Text = Clear
End Sub

Private Sub Command5_Click()
End
End Sub















LOGIKA PROGRAM
Pada laporan ini saya telah membuat program pada VB untuk menghubungkan Visual Basic dengan Database Microsoft Access. Berikut adalah ScreenShot dari program yang telah saya buat :










Private Sub Command1_Click()
Adodc1.Recordset.AddNew
Adodc1.Recordset!NAMA = Text1.Text
Adodc1.Recordset!NPM = Text2.Text
Adodc1.Recordset!KELAS = Text3.Text
DataGrid1.Refresh
If Text1 = "" Or Text2 = "" Or Text3 = "" Then
MsgBox "DATA HARUS DILENGKAPI"
End If
End Sub
Ini adalah perintah pada Command1 yaitu command yang digunakan untuk menginsert data.
Private Sub Command2_Click()
Adodc1.Recordset.Update
Adodc1.Recordset!NAMA = Text1.Text
Adodc1.Recordset!NPM = Text2.Text
Adodc1.Recordset!KELAS = Text3.Text
DataGrid1.Refresh
End Sub
Ini adalah perintah pada Command2 yaitu command yang digunakan untuk mengupdate data.
Private Sub Command3_Click()
If Adodc1.Recordset.BOF Then
MsgBox "DATA SUDAH HABIS"
Else
Adodc1.Recordset.Delete
End If
End Sub
Pada Command3 terdapat perintah untuk menghapus data.

.




OUTPUT PROGRAM

Komentar