0% found this document useful (0 votes)
54 views

Java Frame

This document contains code for a Visual Basic program that allows users to view, add, edit and delete patient records stored in an Oracle database table called "pasien". The code includes event handlers for buttons that allow inserting new records, updating existing records, deleting records, and closing the form. It also includes code to populate fields from the database when editing, clear fields, and run SQL queries to retrieve and save data.

Uploaded by

kudalek_09
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
54 views

Java Frame

This document contains code for a Visual Basic program that allows users to view, add, edit and delete patient records stored in an Oracle database table called "pasien". The code includes event handlers for buttons that allow inserting new records, updating existing records, deleting records, and closing the form. It also includes code to populate fields from the database when editing, clear fields, and run SQL queries to retrieve and save data.

Uploaded by

kudalek_09
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 3

Nama : M.

Huri Agung Setiono

08.1.03.02.0160

Kelas :3D_Teknik Informatika

Tugas Pemrograman Visual II

1. create user contoh/password 2. grant to contoh 3.create table pasien

4.menambah kolom 5. insert into pasien

Oradc properties Dbgrid properties

6.tampilan vb 6.0 8.jika dipilih yes + simpan edit


Private Sub cmdhapus_Click() End Sub
If ORADC1.Recordset.recordcount > 0 Then
sql = "delete from pasien where id='" & Private Sub cmdsimpanedt_Click()
txtid.Text & "'"
sql = "update pasien set id='" & txtid.Text &
ORADC1.Database.executesql sql "',nama='" & txtnama.Text & "',kelamin='" &
txtkelamin.Text & "',
ORADC1.Refresh
usia='" & txtusia.Text & "',pekerjaan='" &
MsgBox ("Data telah terhapus") txtpekerjaan.Text & "',alamat='" & txtalamat.Text
& "',telpn='" & txttelpn.Text & "',
Else
domisili='" & txtdomisili.Text & "',darah='" &
MsgBox ("Cek kembali mahasiswa anda")
txtdarah.Text & "',ktp='" & txtktp.Text & "' where
End If id='" & txtid.Text & "'"

sql = "select*from pasien"


ORADC1.RecordSource = sql ORADC1.Database.executesql sql

ORADC1.Refresh ORADC1.Refresh

End Sub MsgBox ("Data berhasil di edit ")


bersih

Private Sub cmdkeluar_Click() cmdkeluar.Enabled = True

Unload Me End Sub

End Sub
Private Sub Form_Load()

Private Sub cmdsimpan_Click() cmdsimpan.Enabled = False

sql = "insert into cmdsimpanedt.Enabled = False


pasien(id,nama,kelamin,usia,pekerjaan,alamat,telp
cmdsimpanedt.Visible = False
n,domisili,darah,ktp)
End Sub
values('" & txtid.Text & "','" & txtnama.Text &
"','" & txtkelamin.Text & "','" & txtusia.Text &
"','" & txtpekerjaan.Text & "',
Private Sub txtid_KeyPress(KeyAscii As Integer)
'" & txtalamat.Text & "','" & txttelpn.Text & "','"
& txtdomisili.Text & "','" & txtdarah.Text & "','" If KeyAscii = 13 Then
& txtktp.Text & "')"
sql = "select*from pasien where id='" &
txtid.Text & "'"
ORADC1.Database.executesql sql ORADC1.RecordSource = sql
ORADC1.Refresh ORADC1.Refresh
MsgBox (" Data berhasil disimpan ")
bersih
cmdkeluar.Enabled = True
If ORADC1.Recordset.recordcount > 0 Then cmdsimpanedt.Visible = False
pesan = MsgBox(" Data sudah ada .apakah cmdsimpanedt.Enabled = False
anda ingin Mengedit data ?", vbQuestion +
vbYesNo, "EDIT") cmdsimpan.Enabled = True

If pesan = vbYes Then cmdsimpan.Visible = True

txtnama.Text = ORADC1.Recordset!nama cmdkeluar.Enabled = False

txtkelamin.Text = ORADC1.Recordset! End If


kelamin
End Sub
txtusia.Text = ORADC1.Recordset!usia
txtpekerjaan.Text = ORADC1.Recordset!
Sub bersih()
pekerjaan
txtid.Text = ""
txtalamat.Text = ORADC1.Recordset!
alamat txtnama.Text = ""
txttelpn.Text = ORADC1.Recordset!telpn txtkelamin.Text = ""
txtdomisili.Text = ORADC1.Recordset! txtusia.Text = ""
domisili
txtpekerjaan.Text = ""
txtdarah.Text = ORADC1.Recordset!darah
txtalamat.Text = ""
txtktp.Text = ORADC1.Recordset!ktp
txttelpn.Text = ""
txtdomisili.Text = ""
cmdsimpan.Visible = False
txtdarah.Text = ""
cmdsimpanedt.Enabled = True
txtktp.Text = ""
cmdsimpanedt.Visible = True
txtid.SetFocus
cmdkeluar.Enabled = False
Else
sql = "select*from pasien"
bersih
ORADC1.RecordSource = sql
End If
ORADC1.Refresh
End If
End Sub
End If

If ORADC1.Recordset.recordcount < 1 Then


MsgBox ("Data baru ")
sql = "select*from pasien"
ORADC1.RecordSource = sql
ORADC1.Refresh

You might also like