Contact Book - Python Using MySql
A Project Work submitted in partial fulfillment of the
requirements for the degree of
Bachelor of Computer Application
To the
Periyar University,Salem-11
By
SRINIVASAN.P
C21UG105CAP043
GOVERNMENT ARTS COLLEGE-105
(AFFILIATED TO PERIYAR UNIVERSITY)
Dharmapuri-636701
MARCH-2024
ABSTRACT
Requirements definition and management is recognized as a necessary step in the delivery of
successful systems and software projects, discipline is also required by standards, regulations, and
quality improvement initiatives. Creating and managing requirements is a challenge of IT, systems
and product development projects or indeed for any activity where you have to manage a contractual
relationship. Organization need to effectively define and manage requirements to ensure they are
meeting needs of the customer, while proving compliance and staying on the schedule and within
budget. The impact of a poorly expressed requirement can bring a business out of compliance or
even cause injury or death. Requirements definition and management is an activity that can deliver a
high, fast return on investment.
The COMPLETE CONTACT BOOK undertaken as a project is based on relevant technologies.
The main aim of this project is to develop a complete contact book. This project is to develop contact
book containing the details of a person like his/her name, phone numbers, address etc. . This project
has been developed to carry out the processes easily and quickly, which is not possible with the
manuals systems, which are overcome by this software. This project is developed using VB.NET
language .Hence it provides the complete solution for the current management system.
ACKNOWLEDGMENT
I have tried to achieve all requirements of a Complete Contact Book. I am responsible for all the
omissions and errors found in this project.
I as the student of IGNOU , acknowledge the noble and worthy guidance of our teachers of the
IGNOU Centre, HINDU College , Moradabad who gave their support in developing this project.
I express my profound gratitude to my parents providing me his golden opportunity of being student
of this department and for providing all necessary facilities required during this project.
I have parallel faith to work under the guidance of Mr. Ashwini for his invaluable guidance ,
suggestion continous encouragement throughout the project.
A special thanks to IGNOU Director and Regional Director of Regional Centre Aligarh and all
others who are direct or indirect support during in my course of this department; given me a golden
chance of my course for fulfill the project work.
At last but not the least , I would like to thank my friends who had been helpful to me throughout my
project.
Table of Contents
1. Introduction of the Project
1.1. Project Background
1.2. Project Objective
1.3. Purpose and Scope
1.3.1 Purpose
1.3.2 Scope
2. Survey of Technologies
3. Requirements and Analysis
3.1 Problem Definition
3.2 Requirements Specification
3.3 Planning and Scheduling
3.4 Software and Hardware Requirements
3.5 Preliminary Product Description
3.6 Conceptual Models
4. References
5. Source Code
6. Screen Layout
1. INTRODUCTION
Complete Contact Book is an application based project.It is designed for people to store the
information about their contacts. Rather than going through the pages of their diaries and copies to
search a person information, a person can simply use this software to view any of his stored contacts.
A user can also add or update or delete the contact information according to his need. Big
Organizations need to have this software in order to keep the records of thousands of his employees
at one place without any paper work. Also registers maintained for this purpose can be left around, or
can be destroyed in any accident, but in software no such problem will occur.
1.1 Background
The project Complete Contact Book provides a person to add its personal information like name ,
company, phone number, designation , etc. to the database. A user can search any other person or
can update or add a new contact onto the software. Also, user can view the report generated or can
view the groups according to a common field.
Also project provide a questionnaire and suggestions page for the betterment of the project.
1.2 Project Objective
For easy and convenient processing we need to develop software which works as per our
requirements. While preparing this software we got to remember few things i.e. this software must
have a friendly environment, in other words it should not be much complicated to handle, it should
i
have options for future modifications in the society . For smooth functioning, we had to prepare a
database by which we could enter the required data in their respective locations. In this data base all
the records of daily transactions made are stored i.e. Contact Details , so that we can use them in
future whenever needed. From security point of view this software has a special login name and
password allotted to their Admnistraor. Other than that no one could use this and on entering an
illegal password or login name an error message get displayed.
The major specifications of project are:
To allow only authorized user to access various function and processed available in
the system.
Locate any Contact wanted by the user.
Reduced written work and problem of storing the diaries as most of the work done by
computer.
Provide greater speed & reduced time consumption
1.3 Purpose and Scope
Purpose : The overall purpose of this project is to develop a Visual Basic .net which will provide
an interface between controls applications written in the VB.net language and the SQL Server
Management. One aspect of this work will be to develop a language independent object-oriented
model to the accelerator devices.
Scope: The project Contact Book provides the following functionalities:
Add a new contact
Search a contact
ii
Update a contact
Delete a contact
Display report
Show groups
2. Survey of Technologies
iii
The project Contact Book could have been built by various technologies like VB.net, C#, C++,
Java.
I chose VB.net as my front end to build this project because
It is easy to understand
It is easy to install
It has a good GUI which makes it very easy to work with.
MSDN library supports us and give us all the help needed while we come through any errors
or problems.
I was convenient to work with it.
I didn’t chose others because
They don’t have GUI which makes it difficult to understand
No built libraries to solve the problems.
It was inconvenient to work with them.
To develop this package different types of tools and database are used which are as follows:
VB.NET 2008
Framework 4.0
Microsoft SQL Server 2008
Microsoft Word
VB.NET 2008
iv
Visual Basic .NET (VB.NET) is an object-oriented computer programming language that can be
viewed as an evolution of the classic Visual Basic (VB), implemented on the .NET Framework.
Microsoft currently supplies two main editions of IDEs for developing in Visual Basic: Microsoft
Visual Studio 2012, which is commercial software and Visual Basic Express Edition 2012, which
is free of charge. The command-line compiler, VBC.EXE, is installed as part of the freeware .NET
Framework SDK. Mono also includes a command-line VB.NET compiler.
Advantages of VB.NET
1. First of all, VB.NET provides managed code execution that runs under the Common
Language Runtime (CLR), resulting in robust, stable and secure applications. All features of
the .NET framework are readily available in VB.NET.
2. VB.NET is totally object oriented. This is a major addition that VB6 and other earlier
releases didn't have.
3. The .NET framework comes with ADO.NET, which follows the disconnected paradigm, i.e.
once the required records are fetched the connection no longer exists. It also retrieves the
records that are expected to be accessed in the immediate future. This enhances Scalability of
the application to a great extent.
4. VB.NET uses XML to transfer data between the various layers in the DNA Architecture i.e.
data are passed as simple text strings.
5. Error handling has changed in VB.NET. A new Try-Catch-Finally block has been introduced
to handle errors and exceptions as a unit.
6. Another great feature added to VB.NET is free threading against the VB single-threaded
apartment feature.
7. Security has become more robust in VB.NET. In addition to the role-based security in VB6,
VB.NET comes with a new security model, Code Access security.
v
8. The CLR takes care of garbage collection i.e. the CLR releases resources as soon as an object
is no more in use. This relieves the developer from thinking of ways to manage memory.
CLR does this for them
Framework 4.0
Dot net framework is a platform that is provided by Microsoft technology in which we can develop
web based application,window based application and console base application with C#(c sharp),VB
and J#(J sharp) and other 22 Language.
Microsoft SQL Server 2008
Microsoft SQL Server fulfills these responsibilities :
Reduction and redundancy :
Centralized control of the dba avoids the unnecessary duplication of data and effectively
reduces the total amount of data storage required. It also eliminates the extra processing and
of the inconsistencies eg. Same format of grade card for all student.
Sharing data :
Any number of application program of user’s can share the same database .For example we
can access the list of study centers.
Data integrity :
Data integrity means that the data contains in the database both accurate and consistent.
Data security :
In this facility the confidential data must not be accessed by unauthorized person.
vi
Rapidly Accessing Data :
SQL Server provides rapid access to data by utilizing indexes and storing frequently accessed
data in memory
SQL Server Enterprise Manager :
The Enterprise Manager is the central console from which most SQL Server database-
management tasks can be coordinated. SQL Enterprise Manager provides a single interface
from which all servers in a company can be managed.
Microsoft Word
Microsoft Word is a word processor developed by Microsoft. It was first released in 1983 under the
name Multi-Tool Word for Xenix systems .Subsequent versions were later written for several other
platforms including IBM PCs running DOS (1983), the Apple Macintosh (1984), the AT&T Unix
PC (1985), Atari ST (1986), SCO UNIX, OS/2, and Microsoft Windows (1989). It is a component of
the Microsoft Office software system; it is also sold as a standalone product and included
in Microsoft Works Suite.
3. Requirements and Analysis
vii
The Contact Book requires computerizing its storage of contacts in order to provide fully service to
automate the following activities. The requirements from the proposed software are as follows:
Contact Information Handling
Adding a new contact
Deleting a contact
Updating a contact
Searching a contact
3.1 Problem Definition
The problem here is that storing the contact information on paper is little bulky and is difficult to
manage and store these papers. They can be forgotten where they were placed or could be destroyed
by the small animals like rat etc. For a personal purpose it could be managed but for organizations
where there is a need to keep these informations for later use it will create a problem if such thing
happens.
So, why don’t we keep it in our computer as a record. You may say that we could have used WORD
or NOTEPAD , yes we could have used but in that case it would be a little difficult to search a
contact or delete one or add a contact after scrolling thousands of pages of word but the software
CONTACT BOOK provides a total and an easy interface to add , search , delete a contact without
going through pages. All that work will be done by he software itself.
3.2 Requirement Specification
viii
On the basis of system study performed in different fields like mails , facebook etc. about all the
functions that deals with Contact Book following requirements are specified.
Functional Requirements:
The Functional Requirements of the project are as follows:
To provide the functionality to person to view details of contact.
To provide login interface through which only authorized user can pass by.
The application provide contact the option to add the photo from any file in its pc..
This system should handle multiple contacts at the same time.
To functionally enable Contacts define criteria and create Admin.
The application also provides an option to view group belonging to a person.
Non-Functional Requirements
The Non-Functional Requirements of the project are as follows:
The system should be reliable and robust.
The system should be User friendly.
The system should be completely Consistent and Secure.
Interface requirements
Interface should be easy to follow,
Interface shouldn’t have very much graphics,
Interface shouldn’t have hidden buttons, and
Interface shouldn produce relevant error message.
ix
In a complete way, we’re expected to build an application which accommodates all
functionality of an organization that deal with keeping all the contact information.
3.3 Planning and Scheduling
GANTT Chart
Gantt chart are a project control technique that can be used for several purpose including scheduling
and planning. Gantt chart is also known bar chart with each box representing an activity.
PERT chart
x
Pert stands for program evaluation and review technique. A pert chart is a network of boxes and arrows
starting and ending dates for activities.
The modules in the project Contact Book are as follows
xi
3.4 Software and Hardware Requirements
Software Requirements
For development, software’s used are:
Operating System : Windows 7 professional , service pack-1
Platform : .Net
Technology : Visual Studio
Language : VB.net
Backend : SQL server 2008
Editor : Microsoft word 2007
For Development : visual studio .Net setup tools
For Design : Visual studio designer
For deployment, software’s used are :
Operating system : Windows 7 professional, service pack-1
xii
Framework : .Net 2008
IIS : Configured
Backend : sql server 2008
Hardware Requirements
For Development, Hardware’s used are:
1. Intel Core
2. 40GB hard disk
3. 4 GB RAM
For Deployment, Hardware’s used are :
Minimum
1. Intel Core
2. 10 GB hard disk
3. 256MB RAM
Recommended
1. Intel Core
2. 20GB hard disk
3. 1GB RAM
3.5 Preliminary Product Description
xiii
The system will store the contact information to the software.The system can add various contacts
for various persons.One person can be a part of one or more groups.All one needs to do is to change
the database accordingly.Project deals with storing all the information of a person , delete a person
information , update a person information. The modules with its functions described below as:
The application has Login module we need the user name and password facility and only
authorized person is allowed to enter into login page.
The application has Project Module that shows the overview of project and provides an
interface to go to all the operations that can be performed on the software.
The application has add module to add a new contact to the database.
The application has delete module to delete a contact from the database.
The application has search module to search a contact from the database.
The application has update module to update an existing contact in the database.
The application has view module to view all the tables of the database.
The application has query module to perform different queries on the database.
The application has report module to generate a report on the tables currently we have.
The application has group module to show if person belongs to more than one group.
3.6 Conceptual Models
Conceptual model may be used to refer to models which are formed after a conceptualization process
in the mind. Conceptual models represent human intentions or semantics. Conceptualization from
observation of physical existence and conceptual modeling are the necessary means human employ
to think and solve problems. Concepts are used to convey semantics during various natural languages
xiv
based communication. Since a concept might map to multiple semantics by itself, an explicit
formalization is usually required for identifying and locating the intended semantic from several
candidates to avoid misunderstandings and confusions in conceptual models
Database Tables
The tables made in the database for the project are as follows:
TABLE 1 : BASIC DETAILS
FIELD_NAME DATA_TYPE DESCRIPTION
Id Int It show contact id
Contact_name Varchar It show Contact Name
Designation Varchar It show Contact’s
Designation
Company_Name Varchar It shows name of company
person is working in.
TABLE 2 : CONTACT DETAILS
FIELD_NAME DATA_TYPE DESCRIPTION
Id Int It show Contact id
Contact_name Varchar It show Contact Name
Mobile Number Varchar It show Mobile Number
Residence Number Varchar It show Residence phone
xv
number
Office Number Varchar It shows office phone
number
TABLE 3 : ADDRESS DETAILS
FIELD_NAME DATA_TYPE DESCRIPTION
Id Int It show Contact id
Contact_name Varchar It show Contact Name
Permanent Address Varchar It show Permanent address
Residence Address Varchar It show Residence address
Office Address Varchar It shows office address
TABLE 4 : OTHER DETAILS
FIELD_NAME DATA_TYPE DESCRIPTION
Id Int It show Contact id
Contact_name Varchar It show Contact Name
Email ID Varchar It show Email id of the
person
Website Address Varchar It show website address
Fax Number Varchar It shows fax number
TABLE 5 : PHOTO
FIELD_NAME DATA_TYPE DESCRIPTION
xvi
Id Int It show Contact id
PHOTO Picture It stores picture address
Data Flow Diagram
The table structure for the various tables to be used in the proposed software is described in Data
Structure part of this proposal.
The data flow in the software is depicted in next page through Data Flow Diagram (DFD).
Zero Level DFD:
It is the first level of DFD. This shows a overview of the project in a short form. If we want to show
a detailed functions of project we can make level 1 , level 2 dfd and so on……. according to the need
of project.
USER
Request for Operation
COMPLETE Provide service
CONTACT
BOOK
Request Result
CONTACT BOOK
DATABASE
ATTEND Access
Level 1 DFD
ALL TABLES OF
This level of DFD shows a little detailed DATABASE
pictorial description of the project.
xvii
Level 2 DFD
This is the last phase of dfd according to the need of this project. The level 2 DFD is as follows:
xviii
ENTITY RELATIONSHIP DIAGRAM
An ER model is an abstract way of describing a database. In the case of a relational database, which
stores data in tables, some of the data in these tables point to data in other tables - for instance, your
entry in the database could point to several entries for each of the phone numbers that are yours. The
ER model would say that you are an entity, and each phone number is an entity, and the relationship
between you and the phone numbers is 'has a phone number'. Diagrams created to design these
entities and relationships are called entity–relationship diagrams or ER diagrams.
Conceptual data model
This is the highest level ER model in that it contains the least granular detail but establishes the
overall scope of what is to be included within the model set. The conceptual ER model normally
xix
defines master reference data entities that are commonly used by the organization. Developing an
enterprise-wide conceptual ER model is useful to support documenting the data architecture for an
organization.
A conceptual ER model may be used as the foundation for one or more logical data models (see
below). The purpose of the conceptual ER model is then to establish structural metadatacommonality
for the master data entities between the set of logical ER models. The conceptual data model may be
used to form commonality relationships between ER models as a basis for data model integration.
ERD for the project Complete Contact Book is as follows:
4. REFERENCES
The books will be referred during the development of this project are as follows:
xx
PHP and MySQL Web Development (4th Edition) by Luke Welling
Programming VB .NET: A Guide for Experienced Programmers by Gary Cornell
E-BOOKS Related to PHP and Sql Server.
Contents from websites.
5. Source Code
xxi
import mysql.connector
import time
db = mysql.connector.connect(
host="localhost",
user="root",
password="srini@12345",
database="contactbook"
)
cursor = db.cursor()
cursor.execute("""
CREATE TABLE IF NOT EXISTS book (
name char(30) primary key,
address char(100),
mobile char(15),
email char(30)
);
""")
def intro():
print("=" * 80)
print("{:^80s}".format("CONTACT"))
print("{:^80s}".format("BOOK"))
print("{:^80s}".format("PROJECT"))
print("{:^80s}".format("MADE BY: PyForSchool.com"))
print("=" * 80)
print()
time.sleep(2)
def create_record():
name = input("Enter name: ")
address = input("Enter address: ")
mobile = input("Enter mobile: ")
email = input("Enter email: ")
sql = "INSERT INTO book(name,address,mobile,email) VALUES (%s,%s,%s,%s)"
record = (name, address, mobile, email)
cursor.execute(sql, record)
db.commit()
print("Record Entered Successfully\n")
def search(name):
sql = "SELECT * FROM book WHERE name = %s"
value = (name,)
cursor.execute(sql, value)
xxii
record = cursor.fetchone()
if record is None:
print("No such record exists")
else:
print('Name:', record[0])
print('Address:', record[1])
print('Mobile:', record[2])
print('E-mail:', record[3])
def display_all():
cursor.execute("SELECT * FROM book")
print('{0:20}{1:30}{2:15}{3:30}'.format('NAME', 'ADDRESS', 'MOBILE NO', 'E-MAIL'))
for record in cursor:
print('{0:20}{1:30}{2:15}{3:30}'.format(record[0], record[1], record[2], record[3]))
def delete_record(name):
sql = "DELETE FROM book WHERE name = %s"
value = (name,)
cursor.execute(sql, value)
db.commit()
if cursor.rowcount == 0:
print("Record not found")
else:
print("Record deleted successfully")
def modify_record(name):
sql = "SELECT * FROM book WHERE name = %s"
value = (name,)
cursor.execute(sql, value)
record = cursor.fetchone()
if record is None:
print("No such record exists")
else:
while True:
print("\nPress the option you want to edit: ")
print("1. Name")
print("2. Address")
print("3. Mobile")
print("4. BACK")
print()
ch = int(input("Select Your Option (1-4): "))
if ch == 1:
new_name = input("Enter new name: ")
sql = "UPDATE book SET name = %s WHERE name = %s"
values = (new_name, name)
cursor.execute(sql, values)
db.commit()
xxiii
print(cursor.rowcount, "record updated successfully")
elif ch == 2:
new_address = input("Enter new address: ")
sql = "UPDATE book SET address = %s WHERE name = %s"
values = (new_address, name)
cursor.execute(sql, values)
db.commit()
print(cursor.rowcount, "record updated successfully")
elif ch == 3:
new_mobile = input("Enter new mobile : ")
sql = "UPDATE book SET mobile = %s WHERE name = %s"
values = (new_mobile, name)
cursor.execute(sql, values)
db.commit()
print(cursor.rowcount, "record updated successfully")
elif ch == 4:
break
else:
print("Invalid choice !!!\n")
def main():
intro()
while True:
print("\nMAIN MENU ")
print("1. ADD NEW RECORD")
print("2. SEARCH RECORD")
print("3. DISPLAY ALL RECORDS")
print("4. DELETE RECORD")
print("5. MODIFY RECORD")
print("6. EXIT")
print()
ch = int(input("Select Your Option (1-6): "))
print()
if ch == 1:
print("ADD NEW RECORD")
create_record()
elif ch == 2:
print("SEARCH RECORD BY NAME")
name = input("Enter name: ")
search(name)
elif ch == 3:
print("DISPLAY ALL RECORDS")
display_all()
elif ch == 4:
print("DELETE RECORD")
name = input("Enter name: ")
delete_record(name)
elif ch == 5:
xxiv
print("MODIFY RECORD")
name = input("Enter name: ")
modify_record(name)
elif ch == 6:
print("Thanks for using Contact Book")
db.close()
break
else:
print("Invalid choice")
main()
xxv
6.Screen Layout
xxvi
xxvii
xxviii