SlideShare a Scribd company logo
1 of 33
ADD/UPDATE PATIENT
Imports System.Data.SqlClient
Public Class Frmain
Dim Uname1 As String
Dim UNAME2 As String
Dim s As Integer
Private Sub Frmain_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
SET1()
Me.Dispose()
End Sub
Private Sub Frmain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Timer1.Start()
SET1()
FILDOC()
' FILDEP()
End Sub
Private Sub FILDEP()
Dim Con As SqlConnection
Dim Sql As String = Nothing
Dim Reader As SqlDataReader
Dim ComboRow As Integer = -1
Dim Columns As Integer = 0
Dim Cmd As SqlCommand
CMBDEP.Items.Clear()
Con = GetConnect()
Sql = "SELECT DEPARTMENT FROM TBLDEP"
'WHERE Uacct ='" & "Cashier" & "'
Cmd = New SqlCommand(Sql, conn)
Con.Open()
Reader = Cmd.ExecuteReader()
While Reader.Read()
For Columns = 0 To Reader.FieldCount - 1
UNAME2 = Reader.Item(Columns)
Next
CMBDEP.Items.Add(Trim(UNAME2))
ComboRow += 1
End While
CMBDEP.Sorted = True
conn.Close()
End Sub
Private Sub FILDOC()
Dim Con As SqlConnection
Dim Sql As String = Nothing
Dim Reader As SqlDataReader
Dim ComboRow As Integer = -1
Dim Columns As Integer = 0
Dim Cmd As SqlCommand
CBODOC.Items.Clear()
Con = GetConnect()
Sql = "SELECT F_NAME FROM TBLDOCTOR WHERE DUTY ='" & "ON" & "'"
'WHERE Uacct ='" & "Cashier" & "'
Cmd = New SqlCommand(Sql, conn)
Con.Open()
Reader = Cmd.ExecuteReader()
While Reader.Read()
For Columns = 0 To Reader.FieldCount - 1
Uname1 = Reader.Item(Columns)
Next
CBODOC.Items.Add(Trim(Uname1))
ComboRow += 1
End While
CBODOC.Sorted = True
conn.Close()
End Sub
Private Sub SET1()
TXTAD.Text = ""
TXTLN.Text = ""
TXTMN.Text = ""
TXTN.Text = ""
TXTCS.Text = ""
Mtdt.Text = ""
'CMBDEP.Items.Clear()
'CMBDEP.Items.Add("OPD")
'CMBDEP.Items.Add("Ward")
FILDOC()
fildv2()
FILDEP()
s = 1
' DTBD.Value = Now.Date
'DTBD.MaxDate = Now.Date
End Sub
Private Sub fildv2()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE STATUS >'" & "Admitted"
& "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Timer1.Tick
LBLDT.Text = System.DateTime.Today.ToLongDateString
LBLTM.Text = System.DateTime.Now.ToLongTimeString
End Sub
Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTN.TextChanged
SKN()
End Sub
Private Sub SKN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE FIRST_NAME like'" &
Trim(TXTN.Text & "%") & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub chkol()
If TXTN.Text = "" Or TXTAD.Text = "" Or TXTLN.Text = "" Or TXTMN.Text = "" Or
CBODOC.Text = "" Or CMBDEP.Text = "" Or DTBD.Value = Now.Date Or Label10.Text = "chk"
Then
MsgBox("Incomplete Data! Please fill-in all the fields!",
MsgBoxStyle.Critical)
Else
chk1()
End If
End Sub
Private Sub chk1()
If s = 1 Then
'+++++++++
GETID()
ISAVE()
SND()
'++++++++
Else
If Label10.Text = "chk" Then
MsgBox("Please Select Check-up or Admit", MsgBoxStyle.Critical)
ElseIf Label10.Text = "Check-up" Then
getrid()
SND()
End If
End If
End Sub
Private Sub IUPT()
End Sub
Private Sub BTNADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNADD.Click
chkol()
End Sub
Private Sub GETID()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
Dim T As Integer
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT COUNT(PID) FROM TBLPATIENT"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
T = cmdUser.ExecuteScalar()
LBLID.Text = T + 1
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub ISAVE()
Dim check As Integer
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim cmdUser1 As New SqlCommand
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand ' 0 1 2 3
4 5 6 7 8 9 10 11
0 1 2 3 4
5
cmdUser1.CommandText = "INSERT INTO
TBLPATIENT(PID,LAST_NAME,FIRST_NAME,MIDDLE_NAME,BIRTHDATE,ADDRESS,STATUS,ROOM,CHECKIN_DAT
E,CHECKIN_TIME,CHECKOUT_DATE,CHECKOUT_TIME) VALUES('" & LBLID.Text & "','" & TXTLN.Text &
"','" & TXTN.Text & "','" & TXTMN.Text & "','" & Mtdt.Text & "','" & TXTAD.Text & "','" &
Label10.Text & "','" & "N/A" & "','" & LBLDT.Text & "','" & LBLTM.Text & "','" & "N/A" &
"','" & "N/A" & "')"
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :")
Else
MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message :")
End If
conn.Close()
'End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
fildv2()
' getrid()
'
'iupdt()
End Sub
Private Sub getrid()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
Dim R As Integer
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT COUNT(RID) FROM TBLRECORD"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
R = cmdUser.ExecuteScalar()
LBLRID.Text = R + 1
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
R = 0
End Try
conn.Close()
End Sub
Private Sub getdid()
Dim con As New SqlConnection
con = GetConnect()
Dim cdm As New SqlCommand("SELECT DID,DEPARTMENT FROM TBLDOCTOR WHERE F_NAME='" &
CBODOC.Text & "'", con)
con.Open()
Dim reader As SqlDataReader = cdm.ExecuteReader()
If (reader.Read = True) Then
LBLDID.Text = Trim(reader("DID"))
CMBDEP.Text = Trim(reader("DEPARTMENT"))
End If
con.Close()
End Sub
Private Sub iupdt()
Dim check As Integer
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim cmdUser1 As New SqlCommand
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand
cmdUser1.CommandText = "INSERT INTO
TBLRECORD(RID,PID,DID,UID,PCASE,DEPARTMENT,DATE_RECORDED,TIME_RECORDED) VALUES('" &
LBLRID.Text & "','" & LBLID.Text & "','" & LBLDID.Text & "','" & LBLUID.Text & "','" &
TXTCS.Text & "','" & CMBDEP.Text & "','" & LBLDT.Text & "','" & LBLTM.Text & "')"
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
'
'
'
'
' MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :")
' Else
' MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly,
"Message :")
End If
conn.Close()
'End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
SET1()
End Sub
Private Sub dv2_CellClick(ByVal sender As Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellClick
s = 2
LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value())
TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value())
TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value())
TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value())
' DTBD.Value = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value())
Mtdt.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value())
TXTAD.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(5).Value())
End Sub
Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick
s = 2
LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value())
TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value())
TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value())
TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value())
Mtdt.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value())
TXTAD.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(5).Value())
End Sub
Private Sub CBODOC_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CBODOC.SelectedIndexChanged
' getdid()
End Sub
Private Sub BTNUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNUP.Click
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLPATIENT SET [LAST_NAME] ='" &
Trim(TXTLN.Text) & "', [FIRST_NAME] ='" & Trim(TXTN.Text) & "' , [MIDDLE_NAME] ='" &
Trim(TXTMN.Text) & "', [BIRTHDATE] ='" & Trim(Mtdt.Text) & "', [ADDRESS] ='" &
Trim(TXTAD.Text) & "' WHERE PID ='" & Trim(LBLID.Text) & "'"
check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
SET1()
End Sub
Private Sub BTNADM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub SND()
If Label10.Text = "Check-up" Then
Frmadmit.CMBRM.Visible = False
Else
Frmadmit.CMBRM.Visible = True
End If
Frmadmit.TXTN.Text = TXTN.Text
Frmadmit.TXTLN.Text = TXTLN.Text
Frmadmit.TXTMN.Text = TXTMN.Text
Frmadmit.TXTDOC.Text = CBODOC.Text
Frmadmit.TXTDEP.Text = CMBDEP.Text
Frmadmit.TXTAD.Text = TXTAD.Text
Frmadmit.LBLID.Text = LBLID.Text
Frmadmit.LBLDID.Text = LBLDID.Text
Frmadmit.LBLUID.Text = LBLUID.Text
Frmadmit.TXTBD.Text = Mtdt.Text
Frmadmit.TXTCS.Text = TXTCS.Text
Frmadmit.Label18.Text = Label10.Text
Frmadmit.Show()
Me.Hide()
SET1()
End Sub
Private Sub BTNEM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
' Me.Dispose()
End Sub
Private Sub TXTMN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTMN.TextChanged
End Sub
Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTLN.TextChanged
SLN()
End Sub
Private Sub SLN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE LAST_NAME like'" &
Trim(TXTLN.Text & "%") & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCAN.Click
SET1()
End Sub
Private Sub BTNAC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNAC.Click
SET1()
Me.Dispose()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub BTNLOG_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNLOG.Click
Frmlogin.TXTPW.Text = ""
Frmlogin.TXTUN.Text = ""
Frmlogin.Show()
Me.Dispose()
End Sub
Private Sub TXTAD_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTAD.TextChanged
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
End Sub
Private Sub CBODOC_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Handles CBODOC.TextChanged
getdid()
End Sub
Private Sub CMBDEP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CMBDEP.SelectedIndexChanged
End Sub
Private Sub BTNVPR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
End Sub
Private Sub BTNCHK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
'Me.Hide()
End Sub
Private Sub RDCHK_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles RDCHK.CheckedChanged
If RDCHK.Checked = True Then
Label10.Text = "Check-up"
End If
End Sub
Private Sub rdad_CheckedChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles rdad.CheckedChanged
If rdad.Checked = True Then
Label10.Text = "Admitted"
End If
End Sub
Private Sub DTBD_ValueChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles DTBD.ValueChanged
End Sub
End Class
ADMIT PATIENT
Imports System.Data.SqlClient
Public Class Frmadmit
Dim W As Integer
Dim RM As String
Private Sub Frmadmit_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
SET2()
MDIFRM.Show()
Me.Dispose()
End Sub
Private Sub Frmadmit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
set1()
End Sub
Private Sub set1()
Timer1.Start()
FILSEL()
GETRID()
W = 1
FILRM()
End Sub
Private Sub FILRM()
Dim Con As SqlConnection
Dim Sql As String = Nothing
Dim Reader As SqlDataReader
Dim ComboRow As Integer = -1
Dim Columns As Integer = 0
Dim Cmd As SqlCommand
CMBRM.Items.Clear()
Con = GetConnect()
Sql = "SELECT ROOM_NO FROM TBLROOM WHERE CAPACITY > OCCUPANTS"
'WHERE Uacct ='" & "Cashier" & "'
Cmd = New SqlCommand(Sql, conn)
Con.Open()
Reader = Cmd.ExecuteReader()
While Reader.Read()
For Columns = 0 To Reader.FieldCount - 1
RM = Reader.Item(Columns)
Next
CMBRM.Items.Add(Trim(RM))
ComboRow += 1
End While
conn.Close()
End Sub
Private Sub GETRID()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
Dim R As Integer
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT COUNT(RID) FROM TBLRECORD"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
R = cmdUser.ExecuteScalar()
LBLRID.Text = R + 1
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
R = 0
LBLRID.Text = "1"
End Try
conn.Close()
End Sub
Private Sub FILSEL()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLRECORD WHERE PID ='" &
Trim(LBLID.Text) & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLRECORD")
dv2.DataSource = dsuser
dv2.DataMember = "TBLRECORD"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub SET2()
TXTAD.Text = ""
TXTBD.Text = ""
TXTCS.Text = ""
TXTDEP.Text = ""
TXTDIA.Text = ""
TXTDOC.Text = ""
TXTLN.Text = ""
TXTMN.Text = ""
TXTN.Text = ""
TXTP.Text = ""
TXTV.Text = ""
filol()
End Sub
Private Sub filol()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLRECORD"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLRECORD")
dv2.DataSource = dsuser
dv2.DataMember = "TBLRECORD"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Timer1.Tick
Label13.Text = System.DateTime.Today.ToLongDateString
Label14.Text = System.DateTime.Now.ToLongTimeString
End Sub
Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCAN.Click
SET2()
Frmain.Show()
Me.Dispose()
End Sub
Private Sub BTNADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNADD.Click
If TXTDIA.Text = "" Or TXTP.Text = "" Or TXTV.Text = "" Then
MsgBox("Incomplete Data! Please fill-in all the fields!",
MsgBoxStyle.Critical)
Else
ILAGAY()
End If
End Sub
Private Sub ILAGAY()
If Label18.Text = "Check-up" Then
'+++++++++++++++++++++++++++++
Dim check As Integer
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim cmdUser1 As New SqlCommand
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand
cmdUser1.CommandText = "INSERT INTO
TBLRECORD(RID,PID,DID,UID,PCASE,DEPARTMENT,DATE_RECORDED,RECORDED_TIME,VITAL_SIGNS,PRESCR
IPTION,DIAGNOSIS,ROOM,CHECKOUT_DATE,CHECKOUT_TIME) VALUES('" & LBLRID.Text & "','" &
LBLID.Text & "','" & LBLDID.Text & "','" & LBLUID.Text & "','" & TXTCS.Text & "','" &
TXTDEP.Text & "','" & Now.Date.ToShortDateString & "','" &
System.DateTime.Now.ToLongTimeString & "','" & TXTV.Text & "','" & TXTP.Text & "','" &
TXTDIA.Text & "','" & "N/A" & "','" & "N/A" & "','" & "N/A" & "')"
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :")
Else
MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message
:")
End If
conn.Close()
'End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
' iuprm()
' iupp()
set1()
SET2()
Frmain.Show()
Me.Dispose()
'+++++++++++++++++++++++++++++
Else
'================================
Dim check As Integer
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim cmdUser1 As New SqlCommand
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand
cmdUser1.CommandText = "INSERT INTO
TBLRECORD(RID,PID,DID,UID,PCASE,DEPARTMENT,DATE_RECORDED,RECORDED_TIME,VITAL_SIGNS,PRESCR
IPTION,DIAGNOSIS,ROOM,CHECKOUT_DATE,CHECKOUT_TIME) VALUES('" & LBLRID.Text & "','" &
LBLID.Text & "','" & LBLDID.Text & "','" & LBLUID.Text & "','" & TXTCS.Text & "','" &
TXTDEP.Text & "','" & Now.Date.ToShortDateString & "','" &
System.DateTime.Now.ToLongTimeString & "','" & TXTV.Text & "','" & TXTP.Text & "','" &
TXTDIA.Text & "','" & CMBRM.Text & "','" & "N/A" & "','" & "N/A" & "')"
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :")
Else
MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message
:")
End If
conn.Close()
'End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
iuprm()
iupp()
set1()
SET2()
Frmain.Show()
Me.Dispose()
'============================
End If
End Sub
Private Sub iupp()
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLPATIENT SET [STATUS] ='" & "Admitted" &
"',[ROOM] ='" & Trim(CMBRM.Text) & "' WHERE PID ='" & Trim(LBLID.Text) & "'"
check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
'MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
End Sub
Private Sub iuprm()
Label17.Text = Val(Label17.Text) + 1
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLROOM SET [OCCUPANTS] ='" &
Trim(Label17.Text) & "' WHERE ROOM_NO ='" & Trim(CMBRM.Text) & "'"
check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
'MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
End Sub
Private Sub BTNLOG_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNLOG.Click
SET2()
Frmlogin.Show()
Me.Dispose()
End Sub
Private Sub BTNAC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNAC.Click
Me.Dispose()
End Sub
Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTN.TextChanged
End Sub
Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTLN.TextChanged
End Sub
Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
End Sub
Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick
End Sub
Private Sub CMBRM_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs)
Handles CMBRM.TextChanged
Dim con As New SqlConnection
con = GetConnect()
Dim cdm As New SqlCommand("SELECT OCCUPANTS FROM TBLROOM WHERE ROOM_NO='" &
CMBRM.Text & "'", con)
con.Open()
Dim reader As SqlDataReader = cdm.ExecuteReader()
If (reader.Read = True) Then
Label17.Text = Trim(reader("OCCUPANTS"))
'CMBDEP.Text = Trim(reader("DEPARTMENT"))
End If
con.Close()
End Sub
Private Sub CMBRM_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles CMBRM.SelectedIndexChanged
End Sub
End Class
RESET USER ACCOUNT
Imports System.Data.SqlClient
Public Class Frmacct
Private Sub Frmacct_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
Frmain.BringToFront()
Frmain.Enabled = True
Me.Dispose()
End Sub
Private Sub Frmacct_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
set1()
End Sub
Private Sub set1()
txtcpw.Text = ""
TXTPW.Text = ""
TXTUN.Text = ""
End Sub
Private Sub BTNOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNOK.Click
If Not txtcpw.Text = TXTPW.Text Or txtcpw.Text = "" Or TXTPW.Text = "" Then
MsgBox("Password was not confirmed! Please try again!",
MsgBoxStyle.Information)
Else
iupdt()
End If
End Sub
Private Sub iupdt()
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLUSER SET [U_NAME] ='" & Trim(TXTUN.Text) &
"', [PASSWORD] ='" & Trim(TXTPW.Text) & "' WHERE ID ='" & Trim(lblid.Text) & "'"
check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
set1()
Frmain.BringToFront()
Frmain.Enabled = True
Me.Dispose()
End Sub
End Class
CHECKOUT PATIENT
Imports System.Data.SqlClient
Public Class Frmchk
Private Sub Frmchk_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
set1()
End Sub
Private Sub set1()
TXTLN.Text = ""
TXTMN.Text = ""
TXTN.Text = ""
fildv2()
Timer1.Start()
End Sub
Private Sub fildv2()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE STATUS ='" & "Admitted"
& "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTN.TextChanged
SKN()
End Sub
Private Sub SKN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE FIRST_NAME like'" &
Trim(TXTN.Text & "%") & "' AND STATUS ='" & "Admitted" & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTLN.TextChanged
SLN()
End Sub
Private Sub SLN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE LAST_NAME like'" &
Trim(TXTLN.Text & "%") & "' AND STATUS ='" & "Admitted" & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick
LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value())
TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value())
TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value())
TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value())
TextBox1.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(7).Value())
Label4.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(8).Value())
Label5.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(9).Value())
End Sub
Private Sub BTNCHK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCHK.Click
If TXTLN.Text = "" Or TXTMN.Text = "" Or TXTN.Text = "" Then
MsgBox("Incomplete data entry!", MsgBoxStyle.Information)
Else
iupp()
End If
End Sub
Private Sub iupp()
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLPATIENT SET [STATUS] ='" & "Check-out" &
"',[CHECKOUT_DATE] ='" & Trim(LBLDT.Text) & "',[CHECKOUT_TIME] ='" & Trim(LBLTM.Text) &
"' WHERE PID ='" & Trim(LBLID.Text) & "'"
check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
'MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
Label17.Text = Val(Label17.Text) - 1
iuprm()
End Sub
Private Sub iuprm()
Dim check As Integer
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLROOM SET [OCCUPANTS] ='" &
Trim(Label17.Text) & "' WHERE ROOM_NO ='" & Trim(TextBox1.Text) & "'"
check = cmdUser.ExecuteReader.RecordsAffected
If check > 0 Then
'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly)
Else
'MsgBox("Update Failed", MsgBoxStyle.OkOnly)
End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
iuprec()
End Sub
Private Sub iuprec()
Dim cmdUser As New SqlCommand
'Dim daUser As New SqlDataReader
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser = conn.CreateCommand
cmdUser.CommandText = "UPDATE TBLRECORD SET [CHECKOUT_DATE] ='" &
Trim(LBLDT.Text) & "',[CHECKOUT_TIME] ='" & Trim(LBLTM.Text) & "' WHERE PID ='" &
Trim(LBLID.Text) & "'AND DATE_RECORDED ='" & Trim(Label4.Text) & "'"
' check = cmdUser.ExecuteReader.RecordsAffected
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
set1()
End Sub
Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TextBox1.TextChanged
Dim con As New SqlConnection
con = GetConnect()
Dim cdm As New SqlCommand("SELECT OCCUPANTS FROM TBLROOM WHERE ROOM_NO='" &
TextBox1.Text & "'", con)
con.Open()
Dim reader As SqlDataReader = cdm.ExecuteReader()
If (reader.Read = True) Then
Label17.Text = Trim(reader("OCCUPANTS"))
'CMBDEP.Text = Trim(reader("DEPARTMENT"))
End If
con.Close()
End Sub
Private Sub BTNRET_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNRET.Click
set1()
Me.Dispose()
End Sub
Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Timer1.Tick
LBLDT.Text = System.DateTime.Today.ToLongDateString
LBLTM.Text = System.DateTime.Now.ToLongTimeString
End Sub
End Class
ADD/REMOVE DEPARTMENT
Imports System.Data.SqlClient
Public Class Frmdep
Dim d As Integer
Private Sub Frmdep_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
FILD()
TXTN.Text = ""
d = 1
FILD2()
End Sub
Private Sub FILD2()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
Dim T As Integer
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT COUNT(ID) FROM TBLDEP"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
T = cmdUser.ExecuteScalar()
LBLDEP.Text = T + 1
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub FILD()
Dim conn1 As SqlConnection
Dim cmdUser1 As New SqlCommand
Dim daUser1 As New SqlDataAdapter
Dim dsuser1 As New DataSet
Dim dtUser1 As New DataTable
conn1 = GetConnect()
conn1.Open()
Try
cmdUser1 = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser1.CommandText = "SELECT * FROM TBLDEP"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser1.SelectCommand = cmdUser1
daUser1.Fill(dsuser1, "TBLDEP")
dv2.DataSource = dsuser1
dv2.DataMember = "TBLDEP"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn1.Close()
d = 1
TXTN.Text = ""
End Sub
Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTN.TextChanged
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLDEP WHERE DEPARTMENT like'" &
Trim(TXTN.Text & "%") & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLDEP")
dv2.DataSource = dsuser
dv2.DataMember = "TBLDEP"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub BTNADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNADD.Click
isv()
End Sub
Private Sub IKUM1()
Dim con As New SqlConnection
con = GetConnect()
Dim cdm As New SqlCommand("SELECT * FROM TBLDEP WHERE DEPARTMENT='" & TXTN.Text &
"'", con)
con.Open()
Dim reader As SqlDataReader = cdm.ExecuteReader()
If (reader.Read = True) Then
MsgBox("Duplication of Record!", MsgBoxStyle.Exclamation)
TXTN.Focus()
TXTN.SelectAll()
Else
isv()
End If
con.Close()
End Sub
Private Sub isv()
Dim check As Integer
Dim conn As SqlConnection
Dim cmdUser1 As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand
cmdUser1.CommandText = "INSERT INTO TBLDEP VALUES('" & LBLDEP.Text & "','" &
TXTN.Text & "')"
'(User_ID,User_name,Password,Fname,AccType,Logged)
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :")
Else
MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message :")
End If
conn.Close()
'End If
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
FILD()
End Sub
Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCAN.Click
TXTN.Text = ""
Me.Dispose()
End Sub
Private Sub BTNUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNUP.Click
If Not TXTN.Text = "" And d = 2 Then
Dim check As Integer
Dim conn As SqlConnection
Dim cmdUser1 As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsUser As New DataSet
Dim dtUser As New DataTable
Try
conn = GetConnect()
conn.Open()
cmdUser1 = conn.CreateCommand
cmdUser1.CommandText = "DELETE FROM TBLDEP WHERE ID ='" &
Trim(LBLDEP.Text) & "' "
check = cmdUser1.ExecuteReader.RecordsAffected()
If check > 0 Then
MsgBox("Record Deleted", MsgBoxStyle.OkOnly, "Message :")
Else
MsgBox("Deletion Failed Please try again", MsgBoxStyle.OkOnly,
"Message :")
End If
conn.Close()
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
End If
FILD()
End Sub
Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick
d = 2
LBLDEP.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value())
TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value())
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
FILD()
End Sub
End Class
LOGIN FORM
Imports System.Data.SqlClient
Public Class Frmlogin
Private Sub Frmlogin_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
End
End Sub
Private Sub Frmlogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
set1()
End Sub
Private Sub BTNOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNOK.Click
Dim con As New SqlConnection
con = GetConnect()
Dim cdm As New SqlCommand("SELECT * FROM TBLUSER WHERE U_NAME='" & TXTUN.Text &
"'AND Password='" & TXTPW.Text & "'", con)
con.Open()
Dim reader As SqlDataReader = cdm.ExecuteReader()
If (reader.Read = True) Then
lblnme.Text = Trim(reader("F_NAME"))
Label4.Text = Trim(reader("ID"))
MDIFRM.Show()
MDIFRM.Text = "Welcome" + " " + lblnme.Text
MDIFRM.LBLUID.Text = Label4.Text
MDIFRM.lblnme.Text = lblnme.Text
set1()
Me.Hide()
Else
MessageBox.Show("Invalid user name or password!")
set1()
TXTUN.Focus()
End If
End Sub
Private Sub set1()
If TXTUN.Text = "" Or TXTPW.Text = "" Then
BTNOK.Enabled = False
Else
BTNOK.Enabled = True
End If
TXTPW.Text = ""
TXTUN.Text = ""
TXTUN.Select()
End Sub
Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCAN.Click
set1()
End Sub
Private Sub TXTPW_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTPW.TextChanged
If Not TXTUN.Text = "" Or Not TXTPW.Text = "" Then
BTNOK.Enabled = True
Else
BTNOK.Enabled = False
End If
End Sub
Private Sub TXTUN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTUN.TextChanged
If Not TXTUN.Text = "" Or Not TXTPW.Text = "" Then
BTNOK.Enabled = True
Else
BTNOK.Enabled = False
End If
End Sub
End Class
FORM SERCH
Imports System.Data.SqlClient
Public Class Frmsearch
Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As
System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick
LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value())
TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value())
TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value())
TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value())
BLBBD.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value())
LBLADDR.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(5).Value())
End Sub
Private Sub Frmsearch_FormClosed(ByVal sender As Object, ByVal e As
System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed
Frmain.Show()
Me.Dispose()
End Sub
Private Sub Frmsearch_Load(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
SET1()
End Sub
Private Sub SET1()
TXTLN.Text = ""
TXTMN.Text = ""
TXTN.Text = ""
FILDV2()
End Sub
Private Sub FILDV2()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTN.TextChanged
SKN()
End Sub
Private Sub SKN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE FIRST_NAME like'" &
Trim(TXTN.Text & "%") & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTLN.TextChanged
SLN()
End Sub
Private Sub SLN()
Dim conn As SqlConnection
Dim cmdUser As New SqlCommand
Dim daUser As New SqlDataAdapter
Dim dsuser As New DataSet
Dim dtUser As New DataTable
conn = GetConnect()
conn.Open()
Try
cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7
cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE LAST_NAME like'" &
Trim(TXTLN.Text & "%") & "'"
'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "'
daUser.SelectCommand = cmdUser
daUser.Fill(dsuser, "TBLPATIENT")
dv2.DataSource = dsuser
dv2.DataMember = "TBLPATIENT"
dv2.ReadOnly = True
Catch ex As Exception
MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly,
"Connection Error !!")
End Try
conn.Close()
End Sub
Private Sub BTNSHOW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNSHOW.Click
If Not TXTLN.Text = "" Or Not TXTMN.Text = "" Or Not TXTN.Text = "" Then
SND()
FRMVPR.Show()
Frmain.Hide()
Me.Dispose()
Else
MsgBox("Incomplete data entry!", MsgBoxStyle.Information)
End If
End Sub
Private Sub SND()
FRMVPR.TXTN.Text = TXTN.Text
FRMVPR.TXTMN.Text = TXTMN.Text
FRMVPR.TXTLN.Text = TXTLN.Text
FRMVPR.LBLID.Text = LBLID.Text
FRMVPR.TXTBD.Text = BLBBD.Text
FRMVPR.TXTAD.Text = LBLADDR.Text
End Sub
Private Sub BTNCLR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNCLR.Click
SET1()
End Sub
Private Sub BTNRET_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles BTNRET.Click
SET1()
Me.Dispose()
End Sub
Private Sub TXTMN_TextChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles TXTMN.TextChanged
End Sub
End Class

More Related Content

What's hot

Imports my sql
Imports my sqlImports my sql
Imports my sqlobertksg
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84Mahmoud Samir Fayed
 
Ensayo Convergencia Informatica
Ensayo Convergencia InformaticaEnsayo Convergencia Informatica
Ensayo Convergencia Informaticamiguel camelo
 
Auto-GWT : Better GWT Programming with Xtend
Auto-GWT : Better GWT Programming with XtendAuto-GWT : Better GWT Programming with Xtend
Auto-GWT : Better GWT Programming with XtendSven Efftinge
 
Inventory program in mca p1
Inventory program in mca p1Inventory program in mca p1
Inventory program in mca p1rameshvvv
 
The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196Mahmoud Samir Fayed
 
Ejercicios vb primer parcial
Ejercicios vb primer parcialEjercicios vb primer parcial
Ejercicios vb primer parcialJose Jimenez
 
DOM-based Test Adequacy Criteria for Web Applications
DOM-based Test Adequacy Criteria for Web ApplicationsDOM-based Test Adequacy Criteria for Web Applications
DOM-based Test Adequacy Criteria for Web ApplicationsSALT Lab @ UBC
 
Scala - den smarta kusinen
Scala - den smarta kusinenScala - den smarta kusinen
Scala - den smarta kusinenRedpill Linpro
 
ActiveRecord is Rotting Your Brian
ActiveRecord is Rotting Your BrianActiveRecord is Rotting Your Brian
ActiveRecord is Rotting Your BrianEthan Gunderson
 

What's hot (20)

Imports my sql
Imports my sqlImports my sql
Imports my sql
 
Quanlycanbo
QuanlycanboQuanlycanbo
Quanlycanbo
 
Ete programs
Ete programsEte programs
Ete programs
 
The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84The Ring programming language version 1.2 book - Part 5 of 84
The Ring programming language version 1.2 book - Part 5 of 84
 
Elixir par
Elixir parElixir par
Elixir par
 
Ensayo Convergencia Informatica
Ensayo Convergencia InformaticaEnsayo Convergencia Informatica
Ensayo Convergencia Informatica
 
Stop watch and array
Stop watch and arrayStop watch and array
Stop watch and array
 
CRUD VB2010
CRUD VB2010CRUD VB2010
CRUD VB2010
 
Auto-GWT : Better GWT Programming with Xtend
Auto-GWT : Better GWT Programming with XtendAuto-GWT : Better GWT Programming with Xtend
Auto-GWT : Better GWT Programming with Xtend
 
Ast transformations
Ast transformationsAst transformations
Ast transformations
 
Inventory program in mca p1
Inventory program in mca p1Inventory program in mca p1
Inventory program in mca p1
 
The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196The Ring programming language version 1.7 book - Part 7 of 196
The Ring programming language version 1.7 book - Part 7 of 196
 
Gwt and Xtend
Gwt and XtendGwt and Xtend
Gwt and Xtend
 
Ejercicios vb primer parcial
Ejercicios vb primer parcialEjercicios vb primer parcial
Ejercicios vb primer parcial
 
Codes
CodesCodes
Codes
 
Send email
Send emailSend email
Send email
 
Codable routing
Codable routingCodable routing
Codable routing
 
DOM-based Test Adequacy Criteria for Web Applications
DOM-based Test Adequacy Criteria for Web ApplicationsDOM-based Test Adequacy Criteria for Web Applications
DOM-based Test Adequacy Criteria for Web Applications
 
Scala - den smarta kusinen
Scala - den smarta kusinenScala - den smarta kusinen
Scala - den smarta kusinen
 
ActiveRecord is Rotting Your Brian
ActiveRecord is Rotting Your BrianActiveRecord is Rotting Your Brian
ActiveRecord is Rotting Your Brian
 

Viewers also liked

Vibracoes
VibracoesVibracoes
Vibracoesaluno29
 
تعليم الفوركس مع اف اكس اربيا
تعليم الفوركس مع اف اكس اربياتعليم الفوركس مع اف اكس اربيا
تعليم الفوركس مع اف اكس اربياMohamed Mahmoud
 
How to manage expenses better
How to manage expenses betterHow to manage expenses better
How to manage expenses betterGaurav Gaur
 
Kovový nábytek 2014
Kovový nábytek 2014Kovový nábytek 2014
Kovový nábytek 2014kovovynabytek
 
How to manage travel better
How to manage travel betterHow to manage travel better
How to manage travel betterGaurav Gaur
 
Педрада_30.12.2013
Педрада_30.12.2013Педрада_30.12.2013
Педрада_30.12.2013scool35
 
Бібліотеки європи - вершина архітектури
Бібліотеки європи - вершина архітектуриБібліотеки європи - вершина архітектури
Бібліотеки європи - вершина архітектуриscool35
 
Expenzing Travel Manager
Expenzing Travel ManagerExpenzing Travel Manager
Expenzing Travel ManagerGaurav Gaur
 
Oracle database high availability solutions
Oracle database high availability solutionsOracle database high availability solutions
Oracle database high availability solutionsKirill Loifman
 

Viewers also liked (10)

Vibracoes
VibracoesVibracoes
Vibracoes
 
تعليم الفوركس مع اف اكس اربيا
تعليم الفوركس مع اف اكس اربياتعليم الفوركس مع اف اكس اربيا
تعليم الفوركس مع اف اكس اربيا
 
How to manage expenses better
How to manage expenses betterHow to manage expenses better
How to manage expenses better
 
Kovový nábytek 2014
Kovový nábytek 2014Kovový nábytek 2014
Kovový nábytek 2014
 
El aula
El aulaEl aula
El aula
 
How to manage travel better
How to manage travel betterHow to manage travel better
How to manage travel better
 
Педрада_30.12.2013
Педрада_30.12.2013Педрада_30.12.2013
Педрада_30.12.2013
 
Бібліотеки європи - вершина архітектури
Бібліотеки європи - вершина архітектуриБібліотеки європи - вершина архітектури
Бібліотеки європи - вершина архітектури
 
Expenzing Travel Manager
Expenzing Travel ManagerExpenzing Travel Manager
Expenzing Travel Manager
 
Oracle database high availability solutions
Oracle database high availability solutionsOracle database high availability solutions
Oracle database high availability solutions
 

Similar to Codes

Inventory management
Inventory managementInventory management
Inventory managementRajeev Sharan
 
Vb Project ขั้นเทพ
Vb Project ขั้นเทพVb Project ขั้นเทพ
Vb Project ขั้นเทพSinchai Lanon
 
Puerto serialarduino
Puerto serialarduinoPuerto serialarduino
Puerto serialarduinozadkiel_123
 
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERINSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERDarwin Durand
 
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdfImports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdffantabulustredingco
 
.Net Enterprise Services and their Implementations
.Net Enterprise Services and their Implementations.Net Enterprise Services and their Implementations
.Net Enterprise Services and their ImplementationsKashif Aleem
 
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v Arian Gutierrez
 
Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdf
  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf
Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdfapnashop1
 
Updated Visual Basic 6 for beginners.pptx
Updated Visual Basic 6 for beginners.pptxUpdated Visual Basic 6 for beginners.pptx
Updated Visual Basic 6 for beginners.pptxSarveshDeodhar
 
Ejercicio sql server vs visual .net
Ejercicio sql server vs visual .netEjercicio sql server vs visual .net
Ejercicio sql server vs visual .netAyuda Universidad
 
Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaYusman Kurniadi
 
Vb database connections
Vb database connectionsVb database connections
Vb database connectionsTharsikan
 
Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01mafv1976
 
Adodb Scripts And Some Sample Scripts[1]
Adodb Scripts And Some Sample Scripts[1]Adodb Scripts And Some Sample Scripts[1]
Adodb Scripts And Some Sample Scripts[1]testduser1
 
Adodb Scripts And Some Sample Scripts[1]
Adodb Scripts And Some Sample Scripts[1]Adodb Scripts And Some Sample Scripts[1]
Adodb Scripts And Some Sample Scripts[1]User1test
 

Similar to Codes (20)

Kode vb.net
Kode vb.netKode vb.net
Kode vb.net
 
Inventory management
Inventory managementInventory management
Inventory management
 
Vb Project ขั้นเทพ
Vb Project ขั้นเทพVb Project ขั้นเทพ
Vb Project ขั้นเทพ
 
Puerto serialarduino
Puerto serialarduinoPuerto serialarduino
Puerto serialarduino
 
Vb file
Vb fileVb file
Vb file
 
Form1.vb
Form1.vbForm1.vb
Form1.vb
 
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVERINSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
INSERCION DE REGISTROS DESDE VISUAL.NET A UNA BD DE SQL SERVER
 
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdfImports System.Data.OleDb Public Class Form1     Dim connc As Ne.pdf
Imports System.Data.OleDb Public Class Form1 Dim connc As Ne.pdf
 
.Net Enterprise Services and their Implementations
.Net Enterprise Services and their Implementations.Net Enterprise Services and their Implementations
.Net Enterprise Services and their Implementations
 
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
Tipo virus espia con esto aprenderan a espiar a personas etc jeropas de mrd :v
 
VB net lab.pdf
VB net lab.pdfVB net lab.pdf
VB net lab.pdf
 
Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdf
  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf  Imports System.Net.Sockets Imports System.Text Public Class Form1   .pdf
Imports System.Net.Sockets Imports System.Text Public Class Form1 .pdf
 
Updated Visual Basic 6 for beginners.pptx
Updated Visual Basic 6 for beginners.pptxUpdated Visual Basic 6 for beginners.pptx
Updated Visual Basic 6 for beginners.pptx
 
UtilityCostCalcCode
UtilityCostCalcCodeUtilityCostCalcCode
UtilityCostCalcCode
 
Ejercicio sql server vs visual .net
Ejercicio sql server vs visual .netEjercicio sql server vs visual .net
Ejercicio sql server vs visual .net
 
Membuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhanaMembuat aplikasi penjualan buku sederhana
Membuat aplikasi penjualan buku sederhana
 
Vb database connections
Vb database connectionsVb database connections
Vb database connections
 
Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01Sistemadeventas 100707084319-phpapp01
Sistemadeventas 100707084319-phpapp01
 
Adodb Scripts And Some Sample Scripts[1]
Adodb Scripts And Some Sample Scripts[1]Adodb Scripts And Some Sample Scripts[1]
Adodb Scripts And Some Sample Scripts[1]
 
Adodb Scripts And Some Sample Scripts[1]
Adodb Scripts And Some Sample Scripts[1]Adodb Scripts And Some Sample Scripts[1]
Adodb Scripts And Some Sample Scripts[1]
 

Recently uploaded

%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park masabamasaba
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...panagenda
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech studentsHimanshiGarg82
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVshikhaohhpro
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplatePresentation.STUDIO
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfayushiqss
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsAlberto González Trastoy
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxalwaysnagaraju26
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyAnusha Are
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️Delhi Call girls
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsJhone kinadey
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisamasabamasaba
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrainmasabamasaba
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...Nitya salvi
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdfPearlKirahMaeRagusta1
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Steffen Staab
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...Shane Coughlan
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfkalichargn70th171
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrandmasabamasaba
 

Recently uploaded (20)

%in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park %in ivory park+277-882-255-28 abortion pills for sale in ivory park
%in ivory park+277-882-255-28 abortion pills for sale in ivory park
 
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
W01_panagenda_Navigating-the-Future-with-The-Hitchhikers-Guide-to-Notes-and-D...
 
8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students8257 interfacing 2 in microprocessor for btech students
8257 interfacing 2 in microprocessor for btech students
 
Optimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTVOptimizing AI for immediate response in Smart CCTV
Optimizing AI for immediate response in Smart CCTV
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
AI & Machine Learning Presentation Template
AI & Machine Learning Presentation TemplateAI & Machine Learning Presentation Template
AI & Machine Learning Presentation Template
 
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdfThe Top App Development Trends Shaping the Industry in 2024-25 .pdf
The Top App Development Trends Shaping the Industry in 2024-25 .pdf
 
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time ApplicationsUnveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
Unveiling the Tech Salsa of LAMs with Janus in Real-Time Applications
 
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptxBUS PASS MANGEMENT SYSTEM USING PHP.pptx
BUS PASS MANGEMENT SYSTEM USING PHP.pptx
 
Pharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodologyPharm-D Biostatistics and Research methodology
Pharm-D Biostatistics and Research methodology
 
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
call girls in Vaishali (Ghaziabad) 🔝 >༒8448380779 🔝 genuine Escort Service 🔝✔️✔️
 
Right Money Management App For Your Financial Goals
Right Money Management App For Your Financial GoalsRight Money Management App For Your Financial Goals
Right Money Management App For Your Financial Goals
 
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa%in tembisa+277-882-255-28 abortion pills for sale in tembisa
%in tembisa+277-882-255-28 abortion pills for sale in tembisa
 
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
%in Bahrain+277-882-255-28 abortion pills for sale in Bahrain
 
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...Chinsurah Escorts ☎️8617697112  Starting From 5K to 15K High Profile Escorts ...
Chinsurah Escorts ☎️8617697112 Starting From 5K to 15K High Profile Escorts ...
 
Define the academic and professional writing..pdf
Define the academic and professional writing..pdfDefine the academic and professional writing..pdf
Define the academic and professional writing..pdf
 
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
Shapes for Sharing between Graph Data Spaces - and Epistemic Querying of RDF-...
 
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
OpenChain - The Ramifications of ISO/IEC 5230 and ISO/IEC 18974 for Legal Pro...
 
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdfThe Ultimate Test Automation Guide_ Best Practices and Tips.pdf
The Ultimate Test Automation Guide_ Best Practices and Tips.pdf
 
%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand%in Midrand+277-882-255-28 abortion pills for sale in midrand
%in Midrand+277-882-255-28 abortion pills for sale in midrand
 

Codes

  • 1. ADD/UPDATE PATIENT Imports System.Data.SqlClient Public Class Frmain Dim Uname1 As String Dim UNAME2 As String Dim s As Integer Private Sub Frmain_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed SET1() Me.Dispose() End Sub Private Sub Frmain_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load Timer1.Start() SET1() FILDOC() ' FILDEP() End Sub Private Sub FILDEP() Dim Con As SqlConnection Dim Sql As String = Nothing Dim Reader As SqlDataReader Dim ComboRow As Integer = -1 Dim Columns As Integer = 0 Dim Cmd As SqlCommand CMBDEP.Items.Clear() Con = GetConnect() Sql = "SELECT DEPARTMENT FROM TBLDEP" 'WHERE Uacct ='" & "Cashier" & "' Cmd = New SqlCommand(Sql, conn) Con.Open() Reader = Cmd.ExecuteReader() While Reader.Read() For Columns = 0 To Reader.FieldCount - 1 UNAME2 = Reader.Item(Columns) Next CMBDEP.Items.Add(Trim(UNAME2)) ComboRow += 1 End While CMBDEP.Sorted = True conn.Close() End Sub Private Sub FILDOC() Dim Con As SqlConnection Dim Sql As String = Nothing Dim Reader As SqlDataReader Dim ComboRow As Integer = -1 Dim Columns As Integer = 0 Dim Cmd As SqlCommand
  • 2. CBODOC.Items.Clear() Con = GetConnect() Sql = "SELECT F_NAME FROM TBLDOCTOR WHERE DUTY ='" & "ON" & "'" 'WHERE Uacct ='" & "Cashier" & "' Cmd = New SqlCommand(Sql, conn) Con.Open() Reader = Cmd.ExecuteReader() While Reader.Read() For Columns = 0 To Reader.FieldCount - 1 Uname1 = Reader.Item(Columns) Next CBODOC.Items.Add(Trim(Uname1)) ComboRow += 1 End While CBODOC.Sorted = True conn.Close() End Sub Private Sub SET1() TXTAD.Text = "" TXTLN.Text = "" TXTMN.Text = "" TXTN.Text = "" TXTCS.Text = "" Mtdt.Text = "" 'CMBDEP.Items.Clear() 'CMBDEP.Items.Add("OPD") 'CMBDEP.Items.Add("Ward") FILDOC() fildv2() FILDEP() s = 1 ' DTBD.Value = Now.Date 'DTBD.MaxDate = Now.Date End Sub Private Sub fildv2() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE STATUS >'" & "Admitted" & "'" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLPATIENT") dv2.DataSource = dsuser dv2.DataMember = "TBLPATIENT" dv2.ReadOnly = True
  • 3. Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick LBLDT.Text = System.DateTime.Today.ToLongDateString LBLTM.Text = System.DateTime.Now.ToLongTimeString End Sub Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTN.TextChanged SKN() End Sub Private Sub SKN() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE FIRST_NAME like'" & Trim(TXTN.Text & "%") & "'" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLPATIENT") dv2.DataSource = dsuser dv2.DataMember = "TBLPATIENT" dv2.ReadOnly = True Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub chkol() If TXTN.Text = "" Or TXTAD.Text = "" Or TXTLN.Text = "" Or TXTMN.Text = "" Or CBODOC.Text = "" Or CMBDEP.Text = "" Or DTBD.Value = Now.Date Or Label10.Text = "chk" Then MsgBox("Incomplete Data! Please fill-in all the fields!", MsgBoxStyle.Critical) Else chk1()
  • 4. End If End Sub Private Sub chk1() If s = 1 Then '+++++++++ GETID() ISAVE() SND() '++++++++ Else If Label10.Text = "chk" Then MsgBox("Please Select Check-up or Admit", MsgBoxStyle.Critical) ElseIf Label10.Text = "Check-up" Then getrid() SND() End If End If End Sub Private Sub IUPT() End Sub Private Sub BTNADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNADD.Click chkol() End Sub Private Sub GETID() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable Dim T As Integer conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT COUNT(PID) FROM TBLPATIENT" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' T = cmdUser.ExecuteScalar() LBLID.Text = T + 1 Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub ISAVE() Dim check As Integer Dim conn As SqlConnection
  • 5. Dim cmdUser As New SqlCommand Dim cmdUser1 As New SqlCommand Try conn = GetConnect() conn.Open() cmdUser1 = conn.CreateCommand ' 0 1 2 3 4 5 6 7 8 9 10 11 0 1 2 3 4 5 cmdUser1.CommandText = "INSERT INTO TBLPATIENT(PID,LAST_NAME,FIRST_NAME,MIDDLE_NAME,BIRTHDATE,ADDRESS,STATUS,ROOM,CHECKIN_DAT E,CHECKIN_TIME,CHECKOUT_DATE,CHECKOUT_TIME) VALUES('" & LBLID.Text & "','" & TXTLN.Text & "','" & TXTN.Text & "','" & TXTMN.Text & "','" & Mtdt.Text & "','" & TXTAD.Text & "','" & Label10.Text & "','" & "N/A" & "','" & LBLDT.Text & "','" & LBLTM.Text & "','" & "N/A" & "','" & "N/A" & "')" check = cmdUser1.ExecuteReader.RecordsAffected() If check > 0 Then MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :") Else MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message :") End If conn.Close() 'End If Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try fildv2() ' getrid() ' 'iupdt() End Sub Private Sub getrid() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable Dim R As Integer conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT COUNT(RID) FROM TBLRECORD" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' R = cmdUser.ExecuteScalar() LBLRID.Text = R + 1 Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") R = 0
  • 6. End Try conn.Close() End Sub Private Sub getdid() Dim con As New SqlConnection con = GetConnect() Dim cdm As New SqlCommand("SELECT DID,DEPARTMENT FROM TBLDOCTOR WHERE F_NAME='" & CBODOC.Text & "'", con) con.Open() Dim reader As SqlDataReader = cdm.ExecuteReader() If (reader.Read = True) Then LBLDID.Text = Trim(reader("DID")) CMBDEP.Text = Trim(reader("DEPARTMENT")) End If con.Close() End Sub Private Sub iupdt() Dim check As Integer Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim cmdUser1 As New SqlCommand Try conn = GetConnect() conn.Open() cmdUser1 = conn.CreateCommand cmdUser1.CommandText = "INSERT INTO TBLRECORD(RID,PID,DID,UID,PCASE,DEPARTMENT,DATE_RECORDED,TIME_RECORDED) VALUES('" & LBLRID.Text & "','" & LBLID.Text & "','" & LBLDID.Text & "','" & LBLUID.Text & "','" & TXTCS.Text & "','" & CMBDEP.Text & "','" & LBLDT.Text & "','" & LBLTM.Text & "')" check = cmdUser1.ExecuteReader.RecordsAffected() If check > 0 Then ' ' ' ' ' MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :") ' Else ' MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message :") End If conn.Close() 'End If Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try SET1() End Sub Private Sub dv2_CellClick(ByVal sender As Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellClick
  • 7. s = 2 LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value()) TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value()) TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value()) TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value()) ' DTBD.Value = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value()) Mtdt.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value()) TXTAD.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(5).Value()) End Sub Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick s = 2 LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value()) TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value()) TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value()) TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value()) Mtdt.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value()) TXTAD.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(5).Value()) End Sub Private Sub CBODOC_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CBODOC.SelectedIndexChanged ' getdid() End Sub Private Sub BTNUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNUP.Click Dim check As Integer Dim cmdUser As New SqlCommand 'Dim daUser As New SqlDataReader Dim dsUser As New DataSet Dim dtUser As New DataTable Try conn = GetConnect() conn.Open() cmdUser = conn.CreateCommand cmdUser.CommandText = "UPDATE TBLPATIENT SET [LAST_NAME] ='" & Trim(TXTLN.Text) & "', [FIRST_NAME] ='" & Trim(TXTN.Text) & "' , [MIDDLE_NAME] ='" & Trim(TXTMN.Text) & "', [BIRTHDATE] ='" & Trim(Mtdt.Text) & "', [ADDRESS] ='" & Trim(TXTAD.Text) & "' WHERE PID ='" & Trim(LBLID.Text) & "'" check = cmdUser.ExecuteReader.RecordsAffected If check > 0 Then MsgBox("Update Succesfull", MsgBoxStyle.OkOnly) Else MsgBox("Update Failed", MsgBoxStyle.OkOnly) End If Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try SET1() End Sub
  • 8. Private Sub BTNADM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub SND() If Label10.Text = "Check-up" Then Frmadmit.CMBRM.Visible = False Else Frmadmit.CMBRM.Visible = True End If Frmadmit.TXTN.Text = TXTN.Text Frmadmit.TXTLN.Text = TXTLN.Text Frmadmit.TXTMN.Text = TXTMN.Text Frmadmit.TXTDOC.Text = CBODOC.Text Frmadmit.TXTDEP.Text = CMBDEP.Text Frmadmit.TXTAD.Text = TXTAD.Text Frmadmit.LBLID.Text = LBLID.Text Frmadmit.LBLDID.Text = LBLDID.Text Frmadmit.LBLUID.Text = LBLUID.Text Frmadmit.TXTBD.Text = Mtdt.Text Frmadmit.TXTCS.Text = TXTCS.Text Frmadmit.Label18.Text = Label10.Text Frmadmit.Show() Me.Hide() SET1() End Sub Private Sub BTNEM_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) ' Me.Dispose() End Sub Private Sub TXTMN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTMN.TextChanged End Sub Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTLN.TextChanged SLN() End Sub Private Sub SLN() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE LAST_NAME like'" & Trim(TXTLN.Text & "%") & "'" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLPATIENT") dv2.DataSource = dsuser dv2.DataMember = "TBLPATIENT"
  • 9. dv2.ReadOnly = True Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNCAN.Click SET1() End Sub Private Sub BTNAC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNAC.Click SET1() Me.Dispose() End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub BTNLOG_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNLOG.Click Frmlogin.TXTPW.Text = "" Frmlogin.TXTUN.Text = "" Frmlogin.Show() Me.Dispose() End Sub Private Sub TXTAD_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTAD.TextChanged End Sub Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint End Sub Private Sub CBODOC_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CBODOC.TextChanged getdid() End Sub Private Sub CMBDEP_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CMBDEP.SelectedIndexChanged End Sub
  • 10. Private Sub BTNVPR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) End Sub Private Sub BTNCHK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) 'Me.Hide() End Sub Private Sub RDCHK_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles RDCHK.CheckedChanged If RDCHK.Checked = True Then Label10.Text = "Check-up" End If End Sub Private Sub rdad_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles rdad.CheckedChanged If rdad.Checked = True Then Label10.Text = "Admitted" End If End Sub Private Sub DTBD_ValueChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles DTBD.ValueChanged End Sub End Class
  • 11. ADMIT PATIENT Imports System.Data.SqlClient Public Class Frmadmit Dim W As Integer Dim RM As String Private Sub Frmadmit_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed SET2() MDIFRM.Show() Me.Dispose() End Sub Private Sub Frmadmit_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load set1() End Sub Private Sub set1() Timer1.Start() FILSEL() GETRID() W = 1 FILRM() End Sub Private Sub FILRM() Dim Con As SqlConnection Dim Sql As String = Nothing Dim Reader As SqlDataReader Dim ComboRow As Integer = -1 Dim Columns As Integer = 0 Dim Cmd As SqlCommand CMBRM.Items.Clear() Con = GetConnect() Sql = "SELECT ROOM_NO FROM TBLROOM WHERE CAPACITY > OCCUPANTS" 'WHERE Uacct ='" & "Cashier" & "' Cmd = New SqlCommand(Sql, conn) Con.Open() Reader = Cmd.ExecuteReader() While Reader.Read() For Columns = 0 To Reader.FieldCount - 1 RM = Reader.Item(Columns) Next CMBRM.Items.Add(Trim(RM)) ComboRow += 1 End While conn.Close() End Sub Private Sub GETRID() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter
  • 12. Dim dsuser As New DataSet Dim dtUser As New DataTable Dim R As Integer conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT COUNT(RID) FROM TBLRECORD" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' R = cmdUser.ExecuteScalar() LBLRID.Text = R + 1 Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") R = 0 LBLRID.Text = "1" End Try conn.Close() End Sub Private Sub FILSEL() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLRECORD WHERE PID ='" & Trim(LBLID.Text) & "'" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLRECORD") dv2.DataSource = dsuser dv2.DataMember = "TBLRECORD" dv2.ReadOnly = True Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub SET2() TXTAD.Text = "" TXTBD.Text = "" TXTCS.Text = "" TXTDEP.Text = "" TXTDIA.Text = "" TXTDOC.Text = "" TXTLN.Text = "" TXTMN.Text = "" TXTN.Text = ""
  • 13. TXTP.Text = "" TXTV.Text = "" filol() End Sub Private Sub filol() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLRECORD" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLRECORD") dv2.DataSource = dsuser dv2.DataMember = "TBLRECORD" dv2.ReadOnly = True Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick Label13.Text = System.DateTime.Today.ToLongDateString Label14.Text = System.DateTime.Now.ToLongTimeString End Sub Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNCAN.Click SET2() Frmain.Show() Me.Dispose() End Sub Private Sub BTNADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNADD.Click If TXTDIA.Text = "" Or TXTP.Text = "" Or TXTV.Text = "" Then MsgBox("Incomplete Data! Please fill-in all the fields!", MsgBoxStyle.Critical) Else ILAGAY() End If End Sub Private Sub ILAGAY() If Label18.Text = "Check-up" Then '+++++++++++++++++++++++++++++
  • 14. Dim check As Integer Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim cmdUser1 As New SqlCommand Try conn = GetConnect() conn.Open() cmdUser1 = conn.CreateCommand cmdUser1.CommandText = "INSERT INTO TBLRECORD(RID,PID,DID,UID,PCASE,DEPARTMENT,DATE_RECORDED,RECORDED_TIME,VITAL_SIGNS,PRESCR IPTION,DIAGNOSIS,ROOM,CHECKOUT_DATE,CHECKOUT_TIME) VALUES('" & LBLRID.Text & "','" & LBLID.Text & "','" & LBLDID.Text & "','" & LBLUID.Text & "','" & TXTCS.Text & "','" & TXTDEP.Text & "','" & Now.Date.ToShortDateString & "','" & System.DateTime.Now.ToLongTimeString & "','" & TXTV.Text & "','" & TXTP.Text & "','" & TXTDIA.Text & "','" & "N/A" & "','" & "N/A" & "','" & "N/A" & "')" check = cmdUser1.ExecuteReader.RecordsAffected() If check > 0 Then MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :") Else MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message :") End If conn.Close() 'End If Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try ' iuprm() ' iupp() set1() SET2() Frmain.Show() Me.Dispose() '+++++++++++++++++++++++++++++ Else '================================ Dim check As Integer Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim cmdUser1 As New SqlCommand Try conn = GetConnect() conn.Open() cmdUser1 = conn.CreateCommand
  • 15. cmdUser1.CommandText = "INSERT INTO TBLRECORD(RID,PID,DID,UID,PCASE,DEPARTMENT,DATE_RECORDED,RECORDED_TIME,VITAL_SIGNS,PRESCR IPTION,DIAGNOSIS,ROOM,CHECKOUT_DATE,CHECKOUT_TIME) VALUES('" & LBLRID.Text & "','" & LBLID.Text & "','" & LBLDID.Text & "','" & LBLUID.Text & "','" & TXTCS.Text & "','" & TXTDEP.Text & "','" & Now.Date.ToShortDateString & "','" & System.DateTime.Now.ToLongTimeString & "','" & TXTV.Text & "','" & TXTP.Text & "','" & TXTDIA.Text & "','" & CMBRM.Text & "','" & "N/A" & "','" & "N/A" & "')" check = cmdUser1.ExecuteReader.RecordsAffected() If check > 0 Then MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :") Else MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message :") End If conn.Close() 'End If Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try iuprm() iupp() set1() SET2() Frmain.Show() Me.Dispose() '============================ End If End Sub Private Sub iupp() Dim check As Integer Dim cmdUser As New SqlCommand 'Dim daUser As New SqlDataReader Dim dsUser As New DataSet Dim dtUser As New DataTable Try conn = GetConnect() conn.Open() cmdUser = conn.CreateCommand cmdUser.CommandText = "UPDATE TBLPATIENT SET [STATUS] ='" & "Admitted" & "',[ROOM] ='" & Trim(CMBRM.Text) & "' WHERE PID ='" & Trim(LBLID.Text) & "'" check = cmdUser.ExecuteReader.RecordsAffected If check > 0 Then 'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly) Else 'MsgBox("Update Failed", MsgBoxStyle.OkOnly) End If Catch ex As Exception
  • 16. MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try End Sub Private Sub iuprm() Label17.Text = Val(Label17.Text) + 1 Dim check As Integer Dim cmdUser As New SqlCommand 'Dim daUser As New SqlDataReader Dim dsUser As New DataSet Dim dtUser As New DataTable Try conn = GetConnect() conn.Open() cmdUser = conn.CreateCommand cmdUser.CommandText = "UPDATE TBLROOM SET [OCCUPANTS] ='" & Trim(Label17.Text) & "' WHERE ROOM_NO ='" & Trim(CMBRM.Text) & "'" check = cmdUser.ExecuteReader.RecordsAffected If check > 0 Then 'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly) Else 'MsgBox("Update Failed", MsgBoxStyle.OkOnly) End If Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try End Sub Private Sub BTNLOG_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNLOG.Click SET2() Frmlogin.Show() Me.Dispose() End Sub Private Sub BTNAC_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNAC.Click Me.Dispose() End Sub Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTN.TextChanged End Sub Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTLN.TextChanged End Sub Private Sub Panel1_Paint(ByVal sender As System.Object, ByVal e As System.Windows.Forms.PaintEventArgs) Handles Panel1.Paint
  • 17. End Sub Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick End Sub Private Sub CMBRM_TextChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles CMBRM.TextChanged Dim con As New SqlConnection con = GetConnect() Dim cdm As New SqlCommand("SELECT OCCUPANTS FROM TBLROOM WHERE ROOM_NO='" & CMBRM.Text & "'", con) con.Open() Dim reader As SqlDataReader = cdm.ExecuteReader() If (reader.Read = True) Then Label17.Text = Trim(reader("OCCUPANTS")) 'CMBDEP.Text = Trim(reader("DEPARTMENT")) End If con.Close() End Sub Private Sub CMBRM_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles CMBRM.SelectedIndexChanged End Sub End Class
  • 18. RESET USER ACCOUNT Imports System.Data.SqlClient Public Class Frmacct Private Sub Frmacct_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Frmain.BringToFront() Frmain.Enabled = True Me.Dispose() End Sub Private Sub Frmacct_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load set1() End Sub Private Sub set1() txtcpw.Text = "" TXTPW.Text = "" TXTUN.Text = "" End Sub Private Sub BTNOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNOK.Click If Not txtcpw.Text = TXTPW.Text Or txtcpw.Text = "" Or TXTPW.Text = "" Then MsgBox("Password was not confirmed! Please try again!", MsgBoxStyle.Information) Else iupdt() End If End Sub Private Sub iupdt() Dim check As Integer Dim cmdUser As New SqlCommand 'Dim daUser As New SqlDataReader Dim dsUser As New DataSet Dim dtUser As New DataTable Try conn = GetConnect() conn.Open() cmdUser = conn.CreateCommand cmdUser.CommandText = "UPDATE TBLUSER SET [U_NAME] ='" & Trim(TXTUN.Text) & "', [PASSWORD] ='" & Trim(TXTPW.Text) & "' WHERE ID ='" & Trim(lblid.Text) & "'" check = cmdUser.ExecuteReader.RecordsAffected If check > 0 Then MsgBox("Update Succesfull", MsgBoxStyle.OkOnly) Else MsgBox("Update Failed", MsgBoxStyle.OkOnly) End If Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
  • 19. End Try set1() Frmain.BringToFront() Frmain.Enabled = True Me.Dispose() End Sub End Class
  • 20. CHECKOUT PATIENT Imports System.Data.SqlClient Public Class Frmchk Private Sub Frmchk_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load set1() End Sub Private Sub set1() TXTLN.Text = "" TXTMN.Text = "" TXTN.Text = "" fildv2() Timer1.Start() End Sub Private Sub fildv2() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE STATUS ='" & "Admitted" & "'" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLPATIENT") dv2.DataSource = dsuser dv2.DataMember = "TBLPATIENT" dv2.ReadOnly = True Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTN.TextChanged SKN() End Sub Private Sub SKN() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable
  • 21. conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE FIRST_NAME like'" & Trim(TXTN.Text & "%") & "' AND STATUS ='" & "Admitted" & "'" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLPATIENT") dv2.DataSource = dsuser dv2.DataMember = "TBLPATIENT" dv2.ReadOnly = True Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTLN.TextChanged SLN() End Sub Private Sub SLN() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE LAST_NAME like'" & Trim(TXTLN.Text & "%") & "' AND STATUS ='" & "Admitted" & "'" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLPATIENT") dv2.DataSource = dsuser dv2.DataMember = "TBLPATIENT" dv2.ReadOnly = True Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value())
  • 22. TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value()) TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value()) TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value()) TextBox1.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(7).Value()) Label4.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(8).Value()) Label5.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(9).Value()) End Sub Private Sub BTNCHK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNCHK.Click If TXTLN.Text = "" Or TXTMN.Text = "" Or TXTN.Text = "" Then MsgBox("Incomplete data entry!", MsgBoxStyle.Information) Else iupp() End If End Sub Private Sub iupp() Dim check As Integer Dim cmdUser As New SqlCommand 'Dim daUser As New SqlDataReader Dim dsUser As New DataSet Dim dtUser As New DataTable Try conn = GetConnect() conn.Open() cmdUser = conn.CreateCommand cmdUser.CommandText = "UPDATE TBLPATIENT SET [STATUS] ='" & "Check-out" & "',[CHECKOUT_DATE] ='" & Trim(LBLDT.Text) & "',[CHECKOUT_TIME] ='" & Trim(LBLTM.Text) & "' WHERE PID ='" & Trim(LBLID.Text) & "'" check = cmdUser.ExecuteReader.RecordsAffected If check > 0 Then 'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly) Else 'MsgBox("Update Failed", MsgBoxStyle.OkOnly) End If Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try Label17.Text = Val(Label17.Text) - 1 iuprm() End Sub Private Sub iuprm() Dim check As Integer Dim cmdUser As New SqlCommand 'Dim daUser As New SqlDataReader Dim dsUser As New DataSet Dim dtUser As New DataTable Try conn = GetConnect() conn.Open() cmdUser = conn.CreateCommand cmdUser.CommandText = "UPDATE TBLROOM SET [OCCUPANTS] ='" & Trim(Label17.Text) & "' WHERE ROOM_NO ='" & Trim(TextBox1.Text) & "'"
  • 23. check = cmdUser.ExecuteReader.RecordsAffected If check > 0 Then 'MsgBox("Update Succesfull", MsgBoxStyle.OkOnly) Else 'MsgBox("Update Failed", MsgBoxStyle.OkOnly) End If Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try iuprec() End Sub Private Sub iuprec() Dim cmdUser As New SqlCommand 'Dim daUser As New SqlDataReader Dim dsUser As New DataSet Dim dtUser As New DataTable Try conn = GetConnect() conn.Open() cmdUser = conn.CreateCommand cmdUser.CommandText = "UPDATE TBLRECORD SET [CHECKOUT_DATE] ='" & Trim(LBLDT.Text) & "',[CHECKOUT_TIME] ='" & Trim(LBLTM.Text) & "' WHERE PID ='" & Trim(LBLID.Text) & "'AND DATE_RECORDED ='" & Trim(Label4.Text) & "'" ' check = cmdUser.ExecuteReader.RecordsAffected Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try set1() End Sub Private Sub TextBox1_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TextBox1.TextChanged Dim con As New SqlConnection con = GetConnect() Dim cdm As New SqlCommand("SELECT OCCUPANTS FROM TBLROOM WHERE ROOM_NO='" & TextBox1.Text & "'", con) con.Open() Dim reader As SqlDataReader = cdm.ExecuteReader() If (reader.Read = True) Then Label17.Text = Trim(reader("OCCUPANTS")) 'CMBDEP.Text = Trim(reader("DEPARTMENT")) End If con.Close() End Sub Private Sub BTNRET_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNRET.Click set1()
  • 24. Me.Dispose() End Sub Private Sub Timer1_Tick(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Timer1.Tick LBLDT.Text = System.DateTime.Today.ToLongDateString LBLTM.Text = System.DateTime.Now.ToLongTimeString End Sub End Class
  • 25. ADD/REMOVE DEPARTMENT Imports System.Data.SqlClient Public Class Frmdep Dim d As Integer Private Sub Frmdep_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load FILD() TXTN.Text = "" d = 1 FILD2() End Sub Private Sub FILD2() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable Dim T As Integer conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT COUNT(ID) FROM TBLDEP" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' T = cmdUser.ExecuteScalar() LBLDEP.Text = T + 1 Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub FILD() Dim conn1 As SqlConnection Dim cmdUser1 As New SqlCommand Dim daUser1 As New SqlDataAdapter Dim dsuser1 As New DataSet Dim dtUser1 As New DataTable conn1 = GetConnect() conn1.Open() Try cmdUser1 = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser1.CommandText = "SELECT * FROM TBLDEP" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser1.SelectCommand = cmdUser1 daUser1.Fill(dsuser1, "TBLDEP") dv2.DataSource = dsuser1 dv2.DataMember = "TBLDEP" dv2.ReadOnly = True Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!")
  • 26. End Try conn1.Close() d = 1 TXTN.Text = "" End Sub Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTN.TextChanged Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLDEP WHERE DEPARTMENT like'" & Trim(TXTN.Text & "%") & "'" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLDEP") dv2.DataSource = dsuser dv2.DataMember = "TBLDEP" dv2.ReadOnly = True Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub BTNADD_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNADD.Click isv() End Sub Private Sub IKUM1() Dim con As New SqlConnection con = GetConnect() Dim cdm As New SqlCommand("SELECT * FROM TBLDEP WHERE DEPARTMENT='" & TXTN.Text & "'", con) con.Open() Dim reader As SqlDataReader = cdm.ExecuteReader() If (reader.Read = True) Then MsgBox("Duplication of Record!", MsgBoxStyle.Exclamation) TXTN.Focus() TXTN.SelectAll() Else isv() End If con.Close() End Sub
  • 27. Private Sub isv() Dim check As Integer Dim conn As SqlConnection Dim cmdUser1 As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsUser As New DataSet Dim dtUser As New DataTable Try conn = GetConnect() conn.Open() cmdUser1 = conn.CreateCommand cmdUser1.CommandText = "INSERT INTO TBLDEP VALUES('" & LBLDEP.Text & "','" & TXTN.Text & "')" '(User_ID,User_name,Password,Fname,AccType,Logged) check = cmdUser1.ExecuteReader.RecordsAffected() If check > 0 Then MsgBox("Record Added", MsgBoxStyle.OkOnly, "Message :") Else MsgBox("Record Failed Please try again", MsgBoxStyle.OkOnly, "Message :") End If conn.Close() 'End If Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try FILD() End Sub Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNCAN.Click TXTN.Text = "" Me.Dispose() End Sub Private Sub BTNUP_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNUP.Click If Not TXTN.Text = "" And d = 2 Then Dim check As Integer Dim conn As SqlConnection Dim cmdUser1 As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsUser As New DataSet Dim dtUser As New DataTable Try conn = GetConnect() conn.Open() cmdUser1 = conn.CreateCommand
  • 28. cmdUser1.CommandText = "DELETE FROM TBLDEP WHERE ID ='" & Trim(LBLDEP.Text) & "' " check = cmdUser1.ExecuteReader.RecordsAffected() If check > 0 Then MsgBox("Record Deleted", MsgBoxStyle.OkOnly, "Message :") Else MsgBox("Deletion Failed Please try again", MsgBoxStyle.OkOnly, "Message :") End If conn.Close() Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try End If FILD() End Sub Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick d = 2 LBLDEP.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value()) TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value()) End Sub Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click FILD() End Sub End Class
  • 29. LOGIN FORM Imports System.Data.SqlClient Public Class Frmlogin Private Sub Frmlogin_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed End End Sub Private Sub Frmlogin_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load set1() End Sub Private Sub BTNOK_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNOK.Click Dim con As New SqlConnection con = GetConnect() Dim cdm As New SqlCommand("SELECT * FROM TBLUSER WHERE U_NAME='" & TXTUN.Text & "'AND Password='" & TXTPW.Text & "'", con) con.Open() Dim reader As SqlDataReader = cdm.ExecuteReader() If (reader.Read = True) Then lblnme.Text = Trim(reader("F_NAME")) Label4.Text = Trim(reader("ID")) MDIFRM.Show() MDIFRM.Text = "Welcome" + " " + lblnme.Text MDIFRM.LBLUID.Text = Label4.Text MDIFRM.lblnme.Text = lblnme.Text set1() Me.Hide() Else MessageBox.Show("Invalid user name or password!") set1() TXTUN.Focus() End If End Sub Private Sub set1() If TXTUN.Text = "" Or TXTPW.Text = "" Then BTNOK.Enabled = False Else BTNOK.Enabled = True End If TXTPW.Text = "" TXTUN.Text = "" TXTUN.Select() End Sub Private Sub BTNCAN_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNCAN.Click set1() End Sub
  • 30. Private Sub TXTPW_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTPW.TextChanged If Not TXTUN.Text = "" Or Not TXTPW.Text = "" Then BTNOK.Enabled = True Else BTNOK.Enabled = False End If End Sub Private Sub TXTUN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTUN.TextChanged If Not TXTUN.Text = "" Or Not TXTPW.Text = "" Then BTNOK.Enabled = True Else BTNOK.Enabled = False End If End Sub End Class
  • 31. FORM SERCH Imports System.Data.SqlClient Public Class Frmsearch Private Sub dv2_CellContentClick(ByVal sender As System.Object, ByVal e As System.Windows.Forms.DataGridViewCellEventArgs) Handles dv2.CellContentClick LBLID.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(0).Value()) TXTLN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(1).Value()) TXTN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(2).Value()) TXTMN.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(3).Value()) BLBBD.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(4).Value()) LBLADDR.Text = Trim(dv2.Rows(dv2.CurrentRow.Index).Cells(5).Value()) End Sub Private Sub Frmsearch_FormClosed(ByVal sender As Object, ByVal e As System.Windows.Forms.FormClosedEventArgs) Handles Me.FormClosed Frmain.Show() Me.Dispose() End Sub Private Sub Frmsearch_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load SET1() End Sub Private Sub SET1() TXTLN.Text = "" TXTMN.Text = "" TXTN.Text = "" FILDV2() End Sub Private Sub FILDV2() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLPATIENT" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLPATIENT") dv2.DataSource = dsuser dv2.DataMember = "TBLPATIENT" dv2.ReadOnly = True Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close()
  • 32. End Sub Private Sub TXTN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTN.TextChanged SKN() End Sub Private Sub SKN() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE FIRST_NAME like'" & Trim(TXTN.Text & "%") & "'" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLPATIENT") dv2.DataSource = dsuser dv2.DataMember = "TBLPATIENT" dv2.ReadOnly = True Catch ex As Exception MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub TXTLN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTLN.TextChanged SLN() End Sub Private Sub SLN() Dim conn As SqlConnection Dim cmdUser As New SqlCommand Dim daUser As New SqlDataAdapter Dim dsuser As New DataSet Dim dtUser As New DataTable conn = GetConnect() conn.Open() Try cmdUser = conn.CreateCommand '0 1 2 3 4 5 6 7 cmdUser.CommandText = "SELECT * FROM TBLPATIENT WHERE LAST_NAME like'" & Trim(TXTLN.Text & "%") & "'" 'WHERE Prod_ID like'" & Trim(txtp.Text & "%") & "' daUser.SelectCommand = cmdUser daUser.Fill(dsuser, "TBLPATIENT") dv2.DataSource = dsuser dv2.DataMember = "TBLPATIENT" dv2.ReadOnly = True Catch ex As Exception
  • 33. MsgBox("Error: " & ex.Source & ": " & ex.Message, MsgBoxStyle.OkOnly, "Connection Error !!") End Try conn.Close() End Sub Private Sub BTNSHOW_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNSHOW.Click If Not TXTLN.Text = "" Or Not TXTMN.Text = "" Or Not TXTN.Text = "" Then SND() FRMVPR.Show() Frmain.Hide() Me.Dispose() Else MsgBox("Incomplete data entry!", MsgBoxStyle.Information) End If End Sub Private Sub SND() FRMVPR.TXTN.Text = TXTN.Text FRMVPR.TXTMN.Text = TXTMN.Text FRMVPR.TXTLN.Text = TXTLN.Text FRMVPR.LBLID.Text = LBLID.Text FRMVPR.TXTBD.Text = BLBBD.Text FRMVPR.TXTAD.Text = LBLADDR.Text End Sub Private Sub BTNCLR_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNCLR.Click SET1() End Sub Private Sub BTNRET_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles BTNRET.Click SET1() Me.Dispose() End Sub Private Sub TXTMN_TextChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles TXTMN.TextChanged End Sub End Class