PUBLIC SUB btnsimpan_Click()
IF txtid.Text = "" OR txtnama.Text = "" OR txttgl.Text = "" OR txtalamat.Text = "" OR txtno.Text = "" OR txtjml.Text = "" THEN
Message.Warning("Data belum lengkap", "OK")
ELSE
WITH Module1
sql = "insert into karyawan values ('" & txtid.Text & "', '" & txtnama.Text & "', '" & txttgl.Text & "', '" & txtalamat.Text & "', '" & txtno.Text & "', '" & txtjml.Text & "')"
.db.Exec(sql)
tampilkan()
TableView1.Enabled = TRUE
aturtombol(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)
txtcari.Enabled = TRUE
END WITH
ENDIF
END
PUBLIC SUB gbtn_Click()
SELECT CASE LAST.tag
CASE 1
printit(FALSE)
CASE 2
printit(TRUE)
END SELECT
END
PUBLIC SUB btntambah_Click()
bersihin()
aturtext(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)
TableView1.Enabled = FALSE
txtid.setfocus
END
PUBLIC SUB btnubah_Click()
sql = "update karyawan set id ='" & txtid.Text & "',nama='" & txtnama.Text & "',tgl='" & txttgl.Text & "',alamat='" & txtalamat.Text & "',no='" & txtno.Text & "',jml='" & txtjml.Text & "'"
module1.db.Exec(sql)
tampilkan()
IF NOT ERROR THEN
Message.Info("data telah terubah")
ENDIF
FINALLY
CATCH
message.Error(DConv(Error.Text))
tampilkan()
aturtombol(TRUE, TRUE, TRUE, TRUE, TRUE, TRUE, TRUE)
END
PUBLIC SUB btnhapus_Click()
SELECT Message.Question("Yakin Anda Menghapus", "ya", "tidak")
CASE 1
sql = "delete from karyawan where id='" & txtid.Text & "'"
Module1.db.Exec(sql)
tampilkan()
IF NOT ERROR THEN
Message.Info("Data Berhasil Dihapus", "ok")
tampilkan
ENDIF
CASE 2
txtcari.setfocus
END SELECT
btnhapus.Enabled = TRUE
btnubah.Enabled = TRUE
bersihin()
tampilkan()
END
 |
| Add caption |
PUBLIC SUB btncari_Click()
sql = "select * from karyawan where id='" & txtcari.Text & "'"
rsF = Module1.db.Exec(sql)
txtid.Text = rsF!id
txtnama.Text = rsF!nama
txttgl.Text = rsF!tgl
txtalamat.Text = rsF!alamat
txtno.Text = rsF!no
txtjml.Text = rsF!jml
txtid.SetFocus
END
PUBLIC SUB txtcari_GotFocus()
txtcari.Text = ""
END
PUBLIC SUB gbtn_Click()
SELECT CASE LAST.tag
CASE 1
printit(FALSE)
CASE 2
printit(TRUE)
END SELECT
END