Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 25

Republic of the Philippines

APAYAO STATE COLLEGE


San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

In Partial Fulfilment

of the Requirements for Subject

Fundamentals of Database Systems (ITC 112)

Sharmi Joyce Dausen

Mikaela Delos Reyes

Rhona May Arellano

May 2022

Page |1
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

TABLE OF CONTENTS

Page

TITLLE PAGE………………………………………………..……………………………. 1

TABLE OF CONTENTS……………………………..…………………………………… 2

I. INTRODUCTION
Introduction…………………………………………………………………. 3
Explanation of the System………………………………………………… 3
Flow of the System………………………………….................................. 4
Purpose ……………………………………………………………………... 4
II. DATABASE
db_BrgyInformationSystem ….…………………………………………… 5
Tbl_Profile ……………………………..…………………………………… 6
Tbl_Religion ………………………...……………………………………… 6
Tbl_Address ………………………………………………………………… 7
Diagram Pane ………………………………………………………………. 7
III. WINDOWS FORM DESIGNS
frmUser ………..…………………………………………………………...... 8
frmProfile …………………………………………………………..………... 8
IV. RUNNING PROGRAM
LogIn Form ……………………………………………………...….............. 9
Read Record ………………………….…………………………………….. 10
Add Record ………………………………………………………………….. 10
Edit Record ...……………………………………………..……………….. 12
V. SOURCE CODE
Code for the Form User …………..……………………………...….............. 15
Code for the module ………………………………………………………….. 16
Code for the Form Profile ...………………………………………………….. 17

Page |2
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

INTRODUCTION

Our Technology had proven its capacity on how a business, organization and
government keep the productivity and to be competitive. In giving quality service for its
people to satisfy their needs.

We always think that Technology is expensive to have but all this expenses is
worth it because technology gives a way to expand our knowledge, lifestyle and the
capability of being effective in terms of services.

To computerized is an innovation that takes a particular organization to equipped


in this digital age some of the advantage of having a computerize system are: It lessen
the process of large volume of data that are need to be done at a particular time, It will
lessen the risk of having errors in creating a document or report then alternating or
recreating a document can avoid, most of the offices are having hard time to find and
keeping the file in their storage room because in finding a file in a bulk of file in the
storage generally a paper based file is expensive in office space, computerized systems
make it easier for different individual to access data at a less time consuming and faster
way of gathering data or information of a particular organization , employees may
continue having transaction with his/her client.

Explanation of the System

VB.NET is a multi-paradigm programming language developed by Microsoft on


the .NET framework and the SQL Server is a relational database management system
(RDBMS) developed by Microsoft. Barangay Information System was developed using
these two applications the VB.NET platform and SQL server database windows-based
application software. This system can manage and organize the residents of the
barangay. In our system you can add, edit, remove and view information of residents
living in that barangay.

The system is capable of storing information. In the system we have 3 primary


section panels. They are the profile, address, and religion. In the profile panel we can
store information that includes their last name, middle name, first name, age, and
birthday. And in the Address panel we can store information regarding barangay,
municipality, province and a zip code. In the religion panel we can store information
regarding the religion of the residents.

Page |3
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

Flow of the system

These are the steps on how to run Barangay Information Management System in
Vb.net.

Database:

1. First, in an SQL server we created a new database in which we named it


as “db_BrgyInformationSystem”.
2. In the db_BrgyInformationSystem, we added 3 tables namely; tbl_Profile,
tbl_Address, and tbl_Religion.
3. In the tbl_Profile we created 11 columns namely; Profile_ID, Last Name,
Middle name, First name, Username, Password, Birthdate Age, gender,
Add_ID and Rel_ID.
4. In the tbl_Address we created 4 columns namely Barngay, Municipality,
Province and Zip Code
5. In the tbl_Religion we created 1 column only which is Religion.

Visual Basic:

1. First, we Created New Project, DATABASE_BrgyInformation


2. Then, we designed and code the LogIn form which is the frmuser.
3. Then we added a module, which is used to connect the project to the
database.
4. We code the module
5. We added a new form which the frmProfile.
6. We deigned and code the frmProfile
7. Lastly, we tried testing the connection.

Purpose of the System

Barangay Information System (BIS), a system with database, which is capable in


handling numerous records from its area, including the census and demographic profile,
the history of the barangay and land area, the elected barangay officials, the economy
and religion. The barangay is very essential place where it contains information about
the people living there. Some people would seek some information they need that can
only be found in the barangay. With only manual processing it would take time to search
for information. But with the aid of computers it would greatly improve the time and
result you will get compared to manual labour or work done by hand.

Page |4
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

DATABASE

Figure 1.1: db_BrgyInformationSystem

Figure 1.2: Tables in db_BrgyInformationSystem

Page |5
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

Figure 1.3: tbl_Profile Design

Figure 1.4: tblReligion Design

Page |6
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

Figure 1.5: tbl_Address Design

Figure1.6: Diagram Pane

Page |7
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

WINDOWS FORM DESIGNS

Figure 2.1: frmUser

Figure 2.2: frm_Profile

Page |8
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

RUNNING PROGRAM

LogIn Form:

Page |9
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

Read Record

Add Record

P a g e | 10
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

P a g e | 11
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

P a g e | 12
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

Edit Record

P a g e | 13
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

P a g e | 14
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

SOURCE CODE
Code in frmUser:

Dim counter As Integer = 1

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


System.EventArgs) Handles btnlogin.Click

If counter <= 3 Then

sSQL = "select * from tbl_Profile where username = '" & txtname.Text & "' And
Password = '" & txtpassword.Text & "' "
execSQL(sSQL, False)

If RD.Read Then
MsgBox("Login Succesfully")
Me.Dispose()
FrmMain.Show()

Else
MsgBox("Incorrect Username or Password " & counter)
counter = counter + 1
End If
Else
MsgBox("Login Failed !!")
Me.Close()
End If

End Sub

P a g e | 15
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

Code in Module:
Imports System.Data
Imports System.Data.SqlClient
Module mdlconnection
Public conn, conn1, conn2 As New SqlConnection 'for connectivity
Public cmd, cmd1, cmd2 As New SqlCommand 'executing queries
Public RD, RD1, RD2 As SqlDataReader 'for reading/holding data
Public sSQL, sSQL1, sSQL2 As String ' storing SQL Statements
Public constring As String = "data source =LAPTOP-EQ25LTCM\
SQLEXPRESSLAPTOP-EQ25LTCM\SQLEXPRESS; initial catalog =
db_BrgyInformationSystem;integrated security = true"
Public Sub execSQL(ByVal SQLStatement As String, ByVal status As Boolean)
If conn.State = ConnectionState.Open Then conn.Close()
conn.ConnectionString = "data source = LAPTOP-EQ25LTCM\SQLEXPRESS;
initial catalog = db_BrgyInformationSystem;integrated security = true"
conn.Open()
cmd.Connection = conn
cmd.CommandText = SQLStatement
If status = False Then
RD = cmd.ExecuteReader()
Else
cmd.ExecuteNonQuery()
End If
End Sub
Public Sub execSQL1(ByVal SQLStatement As String, ByVal status As Boolean)
If conn1.State = ConnectionState.Open Then conn1.Close()
conn1.ConnectionString = "data source = LAPTOP-EQ25LTCM\SQLEXPRESS;
initial catalog = db_BrgyInformationSystem;integrated security = true"
conn1.Open()
cmd1.Connection = conn1
cmd1.CommandText = SQLStatement
If status = False Then
RD1 = cmd1.ExecuteReader()
Else
cmd1.ExecuteNonQuery()
End If
End Sub
Public Sub execSQL2(ByVal SQLStatement As String, ByVal status As Boolean)
If conn2.State = ConnectionState.Open Then conn2.Close()
conn2.ConnectionString = "data source = LAPTOP-EQ25LTCM\SQLEXPRESS;
initial catalog = db_BrgyInformationSystem;integrated security = true"
conn2.Open()
cmd2.Connection = conn2
cmd2.CommandText = SQLStatement
If status = False Then
RD2 = cmd2.ExecuteReader()
Else
cmd2.ExecuteNonQuery()
End If
End Sub
Public username As String
End Module

P a g e | 16
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

Code in frmProfile:

Public Class frmtbl_profile


Dim gender As String
Sub savecancel()
For Each Obj In Me.GroupBox1.Controls
If TypeOf (Obj) Is TextBox Then
Obj.text = " "
End If

If TypeOf (Obj) Is ComboBox Then


Obj.text = " "
End If

Next
GroupBox1.Enabled = False
End Sub

Sub opt()
gender = cbGender.Text

If cbGender.Text = "Male" Then


gender = "Male"
Else
gender = "Female"
End If
End Sub

Sub loadaddress()
cbAddress.Items.Clear()
While RD2.Read
cbAddress.Items.Add(RD2("barangay"))

P a g e | 17
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

End While
End Sub

Sub loadreligion()
cbReligion.Items.Clear()
While RD1.Read
cbReligion.Items.Add(RD1("Religion"))
End While

End Sub

Sub loadlist()
Try
lvList.Items.Clear()
While RD.Read
With lvList.Items.Add(RD("Profile_ID"), 0)
.SubItems.Add(RD("LastName"))
.SubItems.Add(RD("FirstName"))
.SubItems.Add(RD("MiddleName"))
.SubItems.Add(RD("UserName"))
.SubItems.Add(RD("Birthdate"))
.SubItems.Add(RD("Age"))
.SubItems.Add(RD("Gender"))
.SubItems.Add(RD("Religion"))
.SubItems.Add(RD("Barangay"))
End With
End While
Catch ex As Exception
MsgBox(ex.Message)
Finally
cmd.Dispose()
conn.Close()

P a g e | 18
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

End Try
End Sub

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


System.EventArgs) Handles btnSave.Click
'sSQL = "select * from tbl_Profile where username = '" & txtUname.Text & "' And
Password = '" & txtPassword.Text & "' "
'execSQL(sSQL, False)

If txtLname.Text = "" Or cbReligion.Tag = 0 Or txtFname.Text = "" Or txtAge.Text =


"" Then
MsgBox("Empty Field Detected")

ElseIf Me.Text = "ADD" Then

'sSQL = "insert into tbl_profile values ('" & txtLname.Text & _


' "','" & txtLname.Text & _
' "','" & txtFname.Text & _
' "','" & txtMname.Text & _
' "','" & txtFullname.Text & _
' "','" & txtUname.Text & _
' "','" & txtPassword.Text & _
' "','" & cbGender.Text & _
' "','" & txtAge.Text & _
' "','" & DateTimePicker1.Value & _
' "','" & cbAddress.Tag & _
' "','" & cbReligion.Tag & "')"
'execSQL(sSQL, True)
sSQL = "insert into tbl_profile values ('" & txtLname.Text & "','" & txtFname.Text
& "','" & txtMname.Text & "','" & txtUname.Text & "','" & txtPassword.Text & "','" &
DateTimePicker1.Value & "','" & txtAge.Text & "','" & cbGender.Text & "','" &
cbAddress.Tag & "','" & cbReligion.Tag & "')"
execSQL(sSQL, True)

P a g e | 19
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

MsgBox("Succesfully added new record", MsgBoxStyle.Information, "Added


New Record")
cbAddress.Text = ""
cbReligion.Text = ""
cbGender.Text = ""
cbAddress.Tag = 0
cbReligion.Tag = 0
cbGender.Tag = 0
For Each obj In Me.GroupBox1.Controls
If TypeOf (obj) Is TextBox Then
obj.text = ""
End If
Next

ElseIf Me.Text = "Edit" Then


'sSQL = "insert into tbl_profile values ('" & txtLname.Text & _
' "','" & txtLname.Text & _
' "','" & txtFname.Text & _
' "','" & txtMname.Text & _
' "','" & txtFullname.Text & _
' "','" & txtUname.Text & _
' "','" & txtPassword.Text & _
' "','" & cbGender.Text & _
' "','" & txtAge.Text & _
' "','" & DateTimePicker1.Value & _
' "','" & cbAddress.Tag & _
' "','" & cbReligion.Tag & "')"
'execSQL(sSQL, True)
sSQL = "update tbl_Profile set LastName ='" & txtLname.Text & "', FirstName =
'" & txtFname.Text & "', MiddleName = '" & txtMname.Text & "', UserName = '" &
txtUname.Text & "', Password = '" & txtPassword.Text & "', Birthdate = '" &
DateTimePicker1.Value & "', Age = '" & txtAge.Text & "', Gender = '" & cbGender.Tag &
"', Rel_ID = '" & cbReligion.Tag & "', Add_ID = '" & cbAddress.Tag & "' where Profile_ID
= '" & txtFullname.Tag & "'"

P a g e | 20
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

execSQL(sSQL1, True)
MsgBox("Successfully Updated")

End If
savecancel()
sSQL = "SELECT *, Tbl_Profile.Profile_Id AS Expr1, Tbl_Profile.LastName AS
Expr2, Tbl_Profile.FirstName AS Expr3, Tbl_Profile.MiddleName AS Expr4,
Tbl_Profile.UserName AS Expr5, Tbl_Profile.Password AS Expr6, Tbl_Profile.Birthdate
AS Expr7, Tbl_Profile.Age AS Expr8, Tbl_Profile.Gender AS Expr9,
Tbl_Religion.Religion AS Expr10, Tbl_Address.Barangay AS Expr11 FROM
Tbl_Profile INNER JOIN Tbl_Religion ON Tbl_Profile.Rel_ID = Tbl_Religion.Rel_ID
INNER JOIN Tbl_Address ON Tbl_Profile.Add_ID = Tbl_Address.Add_ID "
execSQL(sSQL, False)
loadlist()

End Sub

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


System.EventArgs) Handles MyBase.Load

sSQL = "SELECT *, Tbl_Profile.Profile_Id AS Expr1, Tbl_Profile.LastName AS


Expr2, Tbl_Profile.FirstName AS Expr3, Tbl_Profile.MiddleName AS Expr4,
Tbl_Profile.UserName AS Expr5, Tbl_Profile.Password AS Expr6, Tbl_Profile.Birthdate
AS Expr7, Tbl_Profile.Age AS Expr8, Tbl_Profile.Gender AS Expr9,
Tbl_Religion.Religion AS Expr10, Tbl_Address.Barangay AS Expr11 FROM
Tbl_Profile INNER JOIN Tbl_Religion ON Tbl_Profile.Rel_ID = Tbl_Religion.Rel_ID
INNER JOIN Tbl_Address ON Tbl_Profile.Add_ID = Tbl_Address.Add_ID "
execSQL(sSQL, False)
loadlist()

sSQL1 = "Select * from tbl_Religion order by Religion"


execSQL1(sSQL1, False)
loadreligion()

sSQL2 = "Select * from tbl_Address "

P a g e | 21
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

execSQL2(sSQL2, False)
loadaddress()

End Sub

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


System.EventArgs) Handles btnAdd.Click
GroupBox1.Enabled = True
Me.Text = "ADD"
End Sub

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


System.EventArgs) Handles txtLname.TextChanged
txtFullname.Text = txtLname.Text & " " & Mid$(txtMname.Text, 1, 1) & "." &
txtFname.Text & " "
End Sub

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


System.EventArgs) Handles txtFname.TextChanged
txtFullname.Text = txtLname.Text & " " & Mid$(txtMname.Text, 1, 1) & " " &
txtFname.Text & "."
End Sub

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


System.EventArgs) Handles txtMname.TextChanged
txtFullname.Text = txtLname.Text & " " & Mid$(txtMname.Text, 1, 1) & "." &
txtFname.Text & " "
End Sub

Private Sub cbAddress_SelectedIndexChanged(ByVal sender As Object, ByVal e As


EventArgs) Handles cbAddress.SelectedIndexChanged
sSQL2 = "select * from tbl_Address where barangay = ' " & cbAddress.Text & " ' "
execSQL(sSQL, False)
If RD.Read Then
cbAddress.Tag = RD("Add_ID")

P a g e | 22
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

End If
End Sub

Private Sub cbReligion_SelectedIndexChanged(ByVal sender As Object, ByVal e As


EventArgs) Handles cbReligion.SelectedIndexChanged
sSQL1 = "select * from tbl_Religion where Religion = ' " & cbReligion.Text & " ' "
execSQL(sSQL, False)
If RD.Read Then
cbReligion.Tag = RD("Rel_ID")
End If
End Sub

Private Sub DateTimePicker1_ValueChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles DateTimePicker1.ValueChanged
Dim ts As TimeSpan = DateTime.Now.Date - DateTimePicker1.Value
txtAge.Text = String.Format("{0:n0} ", (ts.TotalDays / 365))
End Sub

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


System.EventArgs) Handles btnCancel.Click
savecancel()
btnAdd.Enabled = True
btnEdit.Enabled = True
End Sub

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


System.EventArgs) Handles btnEdit.Click
btnAdd.Enabled = False
GroupBox1.Enabled = True
Me.Text = "Edit"

If lvList.SelectedItems.Count = 0 Then
MsgBox("Please Select a record to edit", MsgBoxStyle.Critical, "No Record
Selected")

P a g e | 23
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

Else

txtLname.Text = lvList.SelectedItems(0).SubItems(1).Text
txtFname.Text = lvList.SelectedItems(0).SubItems(2).Text
txtMname.Text = lvList.SelectedItems(0).SubItems(3).Text
txtUname.Text = lvList.SelectedItems(0).SubItems(4).Text
DateTimePicker1.Value = lvList.SelectedItems(0).SubItems(5).Text
txtAge.Text = lvList.SelectedItems(0).SubItems(6).Text
cbGender.Text = lvList.SelectedItems(0).SubItems(7).Text
cbReligion.Text = lvList.SelectedItems(0).SubItems(8).Text
cbAddress.Text = lvList.SelectedItems(0).SubItems(9).Text
End If
End Sub

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


As System.EventArgs) Handles lvList.SelectedIndexChanged

End Sub

Private Sub cbGender_SelectedIndexChanged(ByVal sender As System.Object,


ByVal e As System.EventArgs) Handles cbGender.SelectedIndexChanged
sSQL1 = "select * from tbl_Profile_ID"
execSQL(sSQL, False)
If RD.Read Then
cbGender.Tag = RD("Gender")
End If
End Sub
End Class

P a g e | 24
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.

P a g e | 25

You might also like