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