Sistem Database Data Pasien pada Puskesmas Rawang Pasar IV Kecamatan Rawang Panca Arga Kabupaten Asahan Menggunakan Visual Basic 2010

Teks penuh

(1)

Lampiran 1. Listing Program

1.

Form Login

Imports System.Data.OleDb

Public Class Form1

Dim str As String

Dim kon As OleDbConnection

Dim cmd As OleDbCommand

Dim da As OleDbDataAdapter

Dim ds As DataSet

Dim dt As DataTable

Sub clear()

txtnama.Clear()

txtpass.Clear()

End Sub

Private Sub btnlogin_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles btnlogin.Click

If txtnama.Text = "admin" And txtpass.Text = "1234" Then

home.Show()

Me.Hide()

Else

MsgBox("Silahkan cek kembali Username dan Password

Anda")

End If

End Sub

Private Sub btnbatal_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles btnbatal.Click

clear()

End Sub

Private Sub Form1_Load(ByVal sender As System.Object, ByVal e

(2)

clear()

End Sub

Private Sub btnout_Click(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles btnout.Click

MessageBox.Show("Anda Yakin Ingin Keluar?",

"Pemberitahuan", MessageBoxButtons.YesNo,

MessageBoxIcon.Information)

If vbYes Then

End

Else

Me.Show()

End If

End Sub

End Class

2.

Form Home

Public Class home

Private Sub Button1_Click(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles Button1.Click

Form1.Show()

Me.Hide()

End Sub

Private Sub HelpToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

HelpToolStripMenuItem.Click

Help.Show()

Me.Hide()

End Sub

Private Sub home_Load(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles MyBase.Load

(3)

Private Sub InputDataToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

InputDataToolStripMenuItem.Click

InUmum.Show()

Me.Hide()

End Sub

Private Sub PoliGigiToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

PoliGigiToolStripMenuItem.Click

InGigi.Show()

Me.Hide()

End Sub

Private Sub PoliUmumToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

PoliUmumToolStripMenuItem.Click

dataumum.Show()

Me.Hide()

End Sub

Private Sub ProfilToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

ProfilToolStripMenuItem.Click

profil.Show()

Me.Hide()

End Sub

Private Sub KeluaarToolStripMenuItem_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

KeluaarToolStripMenuItem.Click

MessageBox.Show("Anda Yakin Ingin Keluar?",

"Pemberitahuan", MessageBoxButtons.YesNo,

MessageBoxIcon.Information)

If vbYes Then

End

Else

Me.Show()

(4)

End Sub

Private Sub PoliGigiToolStripMenuItem1_Click(ByVal sender As

System.Object, ByVal e As System.EventArgs) Handles

PoliGigiToolStripMenuItem1.Click

datagigi.Show()

Me.Hide()

End Sub

End Class

3.

Form Profil

Public Class profil

Private Sub bback_Click(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles bback.Click

home.Show()

Me.Hide()

End Sub

End Class

4.

Form Data Pasien Poli Umum

Imports System.Data.OleDb

Public Class dataumum

Dim str As String

Dim kon As OleDbConnection

Dim cmd As OleDbCommand

Dim da As OleDbDataAdapter

Dim ds As DataSet

Private Sub dataumum_Load(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles MyBase.Load

'TODO: This line of code loads data into the

'PasienDataSet.umum' table. You can move, or remove it, as needed.

(5)

End Sub

Public Sub koneksi()

str = "Provider=Microsoft.Jet.OLEDB.4.0;Data

Source=C:\Users\user\Documents\Visual Studio 2010\Projects\New

Puskesmas\Puskesmas\bin\Debug\pasien.mdb;"

kon = New OleDbConnection(str)

End Sub

Public Sub tampil()

Call koneksi()

kon.Open()

da = New OleDbDataAdapter("Select * from umum", kon)

ds = New DataSet

da.Fill(ds, "umum")

DataGridView1.DataSource = (ds.Tables("umum"))

End Sub

Private Sub bback_Click(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles bback.Click

home.Show()

Me.Hide()

End Sub

Private Sub DataGridView1_CellContentClick(ByVal sender As

System.Object, ByVal e As

System.Windows.Forms.DataGridViewCellEventArgs) Handles

DataGridView1.CellContentClick

Call InUmum.tampil()

End Sub

Private Sub txtcari_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcari.TextChanged

Call koneksi()

kon.Open()

cmd = New OleDbCommand("select * from umum where Nama like '%" & txtcari.Text & "%'", kon)

(6)

dr.Read()

If dr.HasRows Then

da = New OleDbDataAdapter("select * from umum where Nama like '%" & txtcari.Text & "%'", kon)

ds = New DataSet da.Fill(ds, "umum")

DataGridView1.DataSource = ds.Tables("umum")

DataGridView1.ReadOnly = True

Else

MsgBox("Data tidak ditemukan")

End If

End Sub

End Class

5.

Form Data Pasien Poli Gigi

Imports System.Data.OleDb

Public Class datagigi

Dim str As String

Dim kon As OleDbConnection

Dim cmd As OleDbCommand

Dim da As OleDbDataAdapter

Dim ds As DataSet

Private Sub datagigi_Load(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles MyBase.Load

'TODO: This line of code loads data into the

'PasienDataSet.gigi' table. You can move, or remove it, as needed.

Me.GigiTableAdapter.Fill(Me.PasienDataSet.gigi)

'TODO: This line of code loads data into the

'PasienDataSet.gigi' table. You can move, or remove it, as needed.

Me.GigiTableAdapter.Fill(Me.PasienDataSet.gigi)

End Sub

(7)

str = "Provider=Microsoft.Jet.OLEDB.4.0;Data

Source=C:\Users\user\Documents\Visual Studio 2010\Projects\New

Puskesmas\Puskesmas\bin\Debug\pasien.mdb;"

kon = New OleDbConnection(str)

End Sub

Public Sub tampil()

Call koneksi()

kon.Open()

da = New OleDbDataAdapter("Select * from gigi", kon)

ds = New DataSet

da.Fill(ds, "gigi")

DataGridView1.DataSource = (ds.Tables("gigi"))

End Sub

Private Sub bback_Click(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles bback.Click

home.Show()

Me.Hide()

End Sub

Private Sub DataGridView1_CellContentClick(ByVal sender As

System.Object, ByVal e As

System.Windows.Forms.DataGridViewCellEventArgs) Handles

DataGridView1.CellContentClick

Call InGigi.tampil()

End Sub

Private Sub txtcari_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcari.TextChanged

Call koneksi()

kon.Open()

cmd = New OleDbCommand("select * from umum where Nama like '%" & txtcari.Text & "%'", kon)

dr = cmd.ExecuteReader

dr.Read()

(8)

da = New OleDbDataAdapter("select * from umum where Nama like '%" & txtcari.Text & "%'", kon)

ds = New DataSet da.Fill(ds, "umum")

DataGridView1.DataSource = ds.Tables("umum")

DataGridView1.ReadOnly = True

Else

MsgBox("Data tidak ditemukan")

End If

End Sub

End Class

6.

Form Input Data Pasien Poli Umum

Imports System.Data.OleDb

Public Class InUmum

Dim str As String

Dim kon As OleDbConnection

Dim cmd As OleDbCommand

Dim da As OleDbDataAdapter

Dim ds As DataSet

Public Sub koneksi()

str = "Provider=Microsoft.Jet.OLEDB.4.0;Data

Source=C:\Users\user\Documents\Visual Studio 2010\Projects\New

Puskesmas\Puskesmas\bin\Debug\pasien.mdb;"

kon = New OleDbConnection(str)

End Sub

Public Sub tampil()

Call koneksi()

kon.Open()

da = New OleDbDataAdapter("Select * from umum", kon)

ds = New DataSet

da.Fill(ds, "umum")

DataGridView1.DataSource = (ds.Tables("umum"))

(9)

Private Sub umum_Load(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles MyBase.Load

'TODO: This line of code loads data into the

'PasienDataSet.umum' table. You can move, or remove it, as needed.

Me.UmumTableAdapter.Fill(Me.PasienDataSet.umum)

'TODO: This line of code loads data into the

'PasienDataSet.umum' table. You can move, or remove it, as needed.

Me.UmumTableAdapter.Fill(Me.PasienDataSet.umum)

'TODO: This line of code loads data into the

'PasienDataSet.umum' table. You can move, or remove it, as needed.

Me.UmumTableAdapter.Fill(Me.PasienDataSet.umum)

End Sub

Public Sub bersih()

txtid.Text = ""

txttanggal.Text = ""

txtnama.Text = ""

txtusia.Text = ""

cbjk.Text = ""

txtalamat.Text = ""

cbstatus.Text = ""

txtidc.Text = ""

txtkeluhan.Text = ""

txthp.Text = ""

txtdiagnosa.Text = ""

txttherapy.Text = ""

txtket.Text = ""

End Sub

Public Sub btnsimpan_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles btnsimpan.Click

Call koneksi()

kon.Open()

Dim sql As String = "insert into umum ([Tanggal], [ID

Pasien], [Nama], [Usia], [Jenis Kelamin], [Alamat], [Status], [ID

Card], [Keluhan], [Hasil Pemeriksaan], [Diagnosa], [Therapy],

(10)

"','" & txtid.Text &

"','" & txtnama.Text &

"','" & txtusia.Text &

"','" & cbjk.Text &

"','" & txtalamat.Text &

"','" & cbstatus.Text &

"','" & txtidc.Text &

"','" & txtkeluhan.Text &

"','" & txthp.Text &

"','" & txtdiagnosa.Text &

"','" & txttherapy.Text &

"','" & txtket.Text & "')"

Dim cmd As New OleDbCommand(sql, kon)

cmd.ExecuteNonQuery()

MessageBox.Show("Data Tersimpan", "Pemberitahuan",

MessageBoxButtons.OK, MessageBoxIcon.Information)

tampil()

bersih()

End Sub

Private Sub DataGridView1_CellClick(ByVal sender As

System.Object, ByVal e As

System.Windows.Forms.DataGridViewCellEventArgs) Handles

DataGridView1.CellClick

Dim i As Integer

i = DataGridView1.CurrentRow.Index

txttanggal.Text = DataGridView1.Item(1, i).Value

txtid.Text = DataGridView1.Item(2, i).Value

txtnama.Text = DataGridView1.Item(3, i).Value

txtusia.Text = DataGridView1.Item(4, i).Value

cbjk.Text = DataGridView1.Item(5, i).Value

txtalamat.Text = DataGridView1.Item(6, i).Value

cbstatus.Text = DataGridView1.Item(7, i).Value

txtidc.Text = DataGridView1.Item(8, i).Value

txtkeluhan.Text = DataGridView1.Item(9, i).Value

(11)

txtdiagnosa.Text = DataGridView1.Item(11, i).Value

txttherapy.Text = DataGridView1.Item(12, i).Value

txtket.Text = DataGridView1.Item(13, i).Value

End Sub

Private Sub btnbatal_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles btnbatal.Click

bersih()

End Sub

Private Sub btnhapus_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles btnhapus.Click

Call koneksi()

kon.Open()

Dim sql As String = "delete from umum where Nama='" &

txtnama.Text & "'"

Dim cmd As New OleDbCommand(sql, kon)

cmd.ExecuteNonQuery()

MsgBox("Data Berhasil Di Hapus")

tampil()

bersih()

End Sub

Private Sub btnedit_Click(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles btnedit.Click

Call koneksi()

kon.Open()

Dim sql As String = "update umum set [Tanggal]='" &

txttanggal.Text &

"',[ID Pasien]='" & txtid.Text &

"',[Usia]='" & txtusia.Text &

"',[Jenis Kelamin]='" & cbjk.Text &

"',[Alamat]='" & txtalamat.Text &

"',[Status]='" & cbstatus.Text &

"',[ID Card]='" & txtidc.Text &

"',[Keluhan]='" & txtkeluhan.Text &

"',[Hasil Pemeriksaan]='" & txthp.Text &

(12)

"',[Therapy]='" & txttherapy.Text &

"',[Keterangan]='" & txtket.Text &

"' where [Nama]='" & txtnama.Text & "'"

Dim cmd As New OleDbCommand(sql, kon)

cmd.ExecuteNonQuery()

MessageBox.Show("Data Diperbaharui", "Pemberitahuan",

MessageBoxButtons.OK, MessageBoxIcon.Information)

tampil()

bersih()

End Sub

Private Sub bback_Click(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles bback.Click

home.Show()

Me.Hide()

End Sub

Private Sub txtcari_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcari.TextChanged

Call koneksi()

kon.Open()

cmd = New OleDbCommand("select * from umum where Nama like '%" & txtcari.Text & "%'", kon)

dr = cmd.ExecuteReader

dr.Read()

If dr.HasRows Then

da = New OleDbDataAdapter("select * from umum where Nama like '%" & txtcari.Text & "%'", kon)

ds = New DataSet da.Fill(ds, "umum")

DataGridView1.DataSource = ds.Tables("umum")

DataGridView1.ReadOnly = True

Else

MsgBox("Data tidak ditemukan")

End If

End Sub

(13)

7.

Form Input Data Pasien Poli Gigi

Imports System.Data.OleDb

Public Class InGigi

Dim str As String

Dim kon As OleDbConnection

Dim cmd As OleDbCommand

Dim da As OleDbDataAdapter

Dim ds As DataSet

Public Sub koneksi()

str = "Provider=Microsoft.Jet.OLEDB.4.0;Data

Source=C:\Users\user\Documents\Visual Studio 2010\Projects\New

Puskesmas\Puskesmas\bin\Debug\pasien.mdb;"

kon = New OleDbConnection(str)

End Sub

Public Sub tampil()

Call koneksi()

kon.Open()

da = New OleDbDataAdapter("Select * from gigi", kon)

ds = New DataSet

da.Fill(ds, "gigi")

DataGridView1.DataSource = (ds.Tables("gigi"))

End Sub

Private Sub InGigi_Load(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles MyBase.Load

'TODO: This line of code loads data into the

'PasienDataSet.gigi' table. You can move, or remove it, as needed.

Me.GigiTableAdapter.Fill(Me.PasienDataSet.gigi)

'TODO: This line of code loads data into the

'PasienDataSet.gigi' table. You can move, or remove it, as needed.

Me.GigiTableAdapter.Fill(Me.PasienDataSet.gigi)

End Sub

Public Sub bersih()

txtid.Text = ""

(14)

txtnama.Text = ""

txtusia.Text = ""

cbjk.Text = ""

txtalamat.Text = ""

cbstatus.Text = ""

txtidc.Text = ""

txtkeluhan.Text = ""

txthp.Text = ""

txtdiagnosa.Text = ""

txttherapy.Text = ""

txtket.Text = ""

End Sub

Public Sub btnsimpan_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles btnsimpan.Click

Call koneksi()

kon.Open()

Dim sql As String = "insert into gigi ([Tanggal], [ID

Pasien], [Nama], [Usia], [Jenis Kelamin], [Alamat], [Status], [ID

Card], [Keluhan], [Hasil Pemeriksaan], [Diagnosa], [Therapy],

[Keterangan]) values('" & txttanggal.Text &

"','" & txtid.Text &

"','" & txtnama.Text &

"','" & txtusia.Text &

"','" & cbjk.Text &

"','" & txtalamat.Text &

"','" & cbstatus.Text &

"','" & txtidc.Text &

"','" & txtkeluhan.Text &

"','" & txthp.Text &

"','" & txtdiagnosa.Text &

"','" & txttherapy.Text &

"','" & txtket.Text & "')"

Dim cmd As New OleDbCommand(sql, kon)

cmd.ExecuteNonQuery()

MessageBox.Show("Data Tersimpan", "Pemberitahuan",

MessageBoxButtons.OK, MessageBoxIcon.Information)

(15)

bersih()

End Sub

Private Sub DataGridView1_CellClick(ByVal sender As

System.Object, ByVal e As

System.Windows.Forms.DataGridViewCellEventArgs) Handles

DataGridView1.CellClick

Dim i As Integer

i = DataGridView1.CurrentRow.Index

'txtno.Text = DataGridView1.Item(0, i).Value

txttanggal.Text = DataGridView1.Item(1, i).Value

txtid.Text = DataGridView1.Item(2, i).Value

txtnama.Text = DataGridView1.Item(3, i).Value

txtusia.Text = DataGridView1.Item(4, i).Value

cbjk.Text = DataGridView1.Item(5, i).Value

txtalamat.Text = DataGridView1.Item(6, i).Value

cbstatus.Text = DataGridView1.Item(7, i).Value

txtidc.Text = DataGridView1.Item(8, i).Value

txtkeluhan.Text = DataGridView1.Item(9, i).Value

txthp.Text = DataGridView1.Item(10, i).Value

txtdiagnosa.Text = DataGridView1.Item(11, i).Value

txttherapy.Text = DataGridView1.Item(12, i).Value

txtket.Text = DataGridView1.Item(13, i).Value

End Sub

Private Sub btnbatal_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles btnbatal.Click

bersih()

End Sub

Private Sub btnhapus_Click(ByVal sender As System.Object,

ByVal e As System.EventArgs) Handles btnhapus.Click

Call koneksi()

kon.Open()

Dim sql As String = "delete from gigi where Nama='" &

(16)

Dim cmd As New OleDbCommand(sql, kon)

cmd.ExecuteNonQuery()

MsgBox("Data Berhasil Di Hapus")

tampil()

bersih()

End Sub

Private Sub btnedit_Click(ByVal sender As System.Object, ByVal

e As System.EventArgs) Handles btnedit.Click

Call koneksi()

kon.Open()

Dim sql As String = "update gigi set [Tanggal]='" &

txttanggal.Text &

"',[ID Pasien]='" & txtid.Text &

"',[Usia]='" & txtusia.Text &

"',[Jenis Kelamin]='" & cbjk.Text &

"',[Alamat]='" & txtalamat.Text &

"',[Status]='" & cbstatus.Text &

"',[ID Card]='" & txtidc.Text &

"',[Keluhan]='" & txtkeluhan.Text &

"',[Hasil Pemeriksaan]='" & txthp.Text &

"',[Diagnosa]='" & txtdiagnosa.Text &

"',[Therapy]='" & txttherapy.Text &

"',[Keterangan]='" & txtket.Text &

"' where [Nama]='" & txtnama.Text & "'"

Dim cmd As New OleDbCommand(sql, kon)

cmd.ExecuteNonQuery()

MessageBox.Show("Data Diperbaharui", "Pemberitahuan",

MessageBoxButtons.OK, MessageBoxIcon.Information)

tampil()

bersih()

End Sub

Private Sub bback_Click(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles bback.Click

home.Show()

Me.Hide()

(17)

Private Sub txtcari_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles txtcari.TextChanged

Call koneksi()

kon.Open()

cmd = New OleDbCommand("select * from gigi where Nama like '%" & txtcari.Text & "%'", kon)

dr = cmd.ExecuteReader

dr.Read()

If dr.HasRows Then

da = New OleDbDataAdapter("select * from gigi where Nama like '%" & txtcari.Text & "%'", kon)

ds = New DataSet da.Fill(ds, "umum")

DataGridView1.DataSource = ds.Tables("umum")

DataGridView1.ReadOnly = True

Else

MsgBox("Data tidak ditemukan")

End If

End Sub

End Class

8.

Form Help

Public Class Help

Private Sub bback_Click(ByVal sender As System.Object, ByVal e

As System.EventArgs) Handles bback.Click

home.Show()

Me.Hide()

End Sub

(18)
(19)
(20)
(21)
(22)
(23)

Figur

Memperbarui...

Referensi

Memperbarui...