Barangay Information System
Barangay Information System
Barangay Information System
In Partial Fulfilment
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.
Page |3
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.
These are the steps on how to run Barangay Information Management System in
Vb.net.
Database:
Visual Basic:
Page |4
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.
DATABASE
Page |5
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.
Page |6
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.
Page |7
Republic of the Philippines
APAYAO STATE COLLEGE
San Isidro Sur, Luna, Apayao, Philippines 3813
asc.edu.ph,www.facebook.com/asceduofficial.
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:
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:
Next
GroupBox1.Enabled = False
End Sub
Sub opt()
gender = cbGender.Text
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
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.
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
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
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
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
End Sub
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