Вы находитесь на странице: 1из 43

KTM BIKE SHOWROOM MANAGMENT

1. Introduction to SQL

SQL (pronounced "ess-que-el") stands for Structured Query Language.


SQL is used to communicate with a database.
According to ANSI (American National Standards Institute), it is the standard language for relational
database management systems.
SQL statements are used to perform tasks such as update data on a database, or retrieve data from a
database.
Some common relational database management systems that use SQL are: Oracle, Sybase, Microsoft
SQL Server, Access, Ingres, etc. Although most database systems use SQL, most of them also have their
own additional proprietary extensions that are usually only used on their system.

2. Data Definition Language (DDL)


DDL statements are used to build and modify the structure of our tables and other objects in the database. When
we execute a DDL statement, it takes effect immediately.

2.1 Create table


The CREATE TABLE statement is used to create a table in a database.
Tables are organized into rows and columns; and each table must have a name.
SQL CREATE TABLE Syntax:
CREATE TABLE table_name
(
column_name1 data_type(size),
column_name2 data_type(size),
column_name3 data_type(size),
....
);
The column_name parameters specify the names of the columns of the table.
The data_type parameter specifies what type of data the column can hold (e.g. varchar, integer, decimal,
date, etc.).
The size parameter specifies the maximum length of the column of the table.

Exampleon CREATE Table:


CREATE TABLE Persons
(
PersonIDint,
LastNamevarchar(255),
FirstNamevarchar(255),
DBMS

KTM BIKE SHOWROOM MANAGMENT

Address varchar(255),
City varchar(255)
);

2.2 Alter Table


A database tablescan be altered by using the ALTER command which can possible by adding new
Column_name along with their respective data_type.
To add a column in a table, use the following syntax:
ALTER TABLE table_name
ADD column_namedatatype;

Example query for ALTER table:


ALTER TABLE Employee
ADD Statevarchar(200);

2.3 Create View


In SQL, a view is a virtual table based on the result-set of an SQL statement.
A view contains rows and columns, just like a real table. The fields in a view are fields from one or more real
tables in the database.
You can add SQL functions, WHERE, and JOIN statements to a view and present the data as if the data were
coming
From a single table,
CREATE VIEW Syntax
CREATE VIEW view_name AS
SELECT column_name(s)
FROM table_name
WHERE condition

Example for CREATE VIEW


The view "Current Product List" lists all active products (products that are not discontinued) from the
"Products" table.
The view is created with the following SQL:
CREATE VIEW [Current Product List] AS
SELECT ProductID, ProductName
FROM Products
WHERE Discontinued=No
DBMS

KTM BIKE SHOWROOM MANAGMENT

3. Data Manipulation Language(DML)


DML statements are used to work with the data in tables. When you are
Connected to most multi-user databases (whether in a client program or by a
Connection from a Web page script), you are in effect working with a private
Copy of your tables that cant be seen by anyone else until you are finished (or
Tell the system that you are finished). You have already seen the SELECT
Statement; it is considered to be part of DML even though it just retrieves data
Rather than modifying it.

3.1 Insert
The INSERT INTO statement is used to insert new records in a table.
SQL INSERT INTO Syntax
It is possible to write the INSERT INTO statement in two forms.
The first form does not specify the column names where the data will be inserted, only their values:
INSERT INTO table_name
VALUES (value1,value2,value3,...);
The second form specifies both the column names and the values to be inserted:
INSERT INTO table_name (column1,column2,column3,...)
VALUES (value1,value2,value3,...);

INSERT INTO Example


Assume we wish to insert a new row in the "Customers" table.
INSERT INTO Customers (CustomerName, ContactName, Address, City, PostalCode,Country)
VALUES ('Cardinal','Tom B. Erichsen','Skagen 21','Stavanger','4006','Norway');

3.2 Update
The UPDATE statement is used to update existing records in a table.
SQL UPDATE Syntax
UPDATE table_name
SET column1=value1,column2=value2,...
WHERE some_column=some_value;

SQL UPDATE Example


DBMS

KTM BIKE SHOWROOM MANAGMENT

Assume we wish to update the customer "AlfredsFutterkiste" with a new contact person and city.
UPDATE Customers
SET ContactName='Alfred Schmidt', City='Hamburg'
WHERE CustomerName='AlfredsFutterkiste';

3.2.1 Delete
The SQL DELETE Statement
The DELETE statement is used to delete rows in a table.
SQL DELETE Syntax
DELETE FROM table_name
WHERE some_column=some_value;

DELETE Example
Assume we wish to delete the customer "AlfredsFutterkiste" from the "Customers" table.
DELETE FROM Customers
WHERE CustomerName='AlfredsFutterkiste' AND ContactName='Maria Anders';

Delete All Data


It is possible to delete all rows in a table without deleting the table. This means that the table structure,
attributes, and indexes will be intact:
DELETE FROM table_name;
or
DELETE * FROM table_name;

3.2.2 Select
The SELECT statement is used to select data from a database.
The result is stored in a result table, called the result-set.
SQL SELECT Syntax:
SELECT column_name,column_name
FROM table_name;
also
SELECT * FROM table_name;
DBMS

KTM BIKE SHOWROOM MANAGMENT

SELECT Column Example


The following SQL statement selects the "CustomerName" and "City" columns from the "Customers" table:
SELECT CustomerName,City FROM Customers;
The SQL SELECT DISTINCT Statement
In a table, a column may contain many duplicate values; and sometimes you only want to list the different
(distinct) values.The DISTINCT keyword can be used to return only distinct (different) values.
SQL SELECT DISTINCT Syntax:
SELECT DISTINCT column_name,column_name
FROM table_name;
Ex: SELECT DISTINCT City FROM Customers;
4.

Data Control Language(DCL)

A data control language (DCL) is a syntax similar to a computer programming language used to control access
to data stored in a database. In particular, it is a component of Structured Query Language (SQL).
The operations for which privileges may be granted to or revoked from a user or role may include CONNECT,
SELECT, INSERT, UPDATE, DELETE, EXECUTE, and USAGE.
In the Oracle database, executing a DCL command issues an implicit commit. Hence you cannot roll back the
command.
4.1 Begin Transaction
4.2 Commit
The COMMIT statement ends the current transaction, making any changes made during that transaction
permanent, and visible to other users.
Commit Syntax:
SQL>commit;

Commit Example:
BEGIN
UPDATE emp_information SET emp_dept='Web Developer'
WHERE emp_name='bhavesh';

DBMS

KTM BIKE SHOWROOM MANAGMENT

COMMIT;
END;
4.3 Rollback
The ROLLBACK statement ends the current transaction and undoes any changes made during that transaction.
If you make a mistake, such as deleting the wrong row from a table, a rollback restores the original data. If you
cannot finish a transaction because an exception is raised or a SQL statement fails, a rollback lets you take
corrective action and perhaps start over.
ROLLBACK Syntax:
INSERT INTO table_name VALUES (value1,value2..,values n)
BEGIN TRANSACTION
(-- Some Operations--)
ROLLBACK;

ROLLBACK Example:
INSERT INTO Book_Issue VALUES (12334,HTML5 Reference, Hans Tom,2005)
BEGIN TRANSACTION
UPDATE Book_Issue SET author = Hans Tom
WHERE Book_Id = 12334
ROLLBACK;

5.Database Administration (DBA)


A database administrator is a person responsible for the installation, configuration, upgrade, administration,
monitoring and maintenance of databases.
5.1 Create Database
The CREATE DATABASE statement is used to create a database.
SQL CREATE DATABASE Syntax
CREATE DATABASE dbname;

SQL CREATE DATABASE Example


The following SQL statement creates a database called "my_db":
CREATE DATABASE my_db;
DBMS

KTM BIKE SHOWROOM MANAGMENT

Database tables can be added with the CREATE TABLE statement.


5.2 Create tablespace
The following is a CREATE TABLESPACE statement that creates a simple permanent tablespace:
CREATE TABLESPACE tbs_perm_01
DATAFILE 'tbs_perm_01.dat'
SIZE 20M
ONLINE;
This CREATE TABLESPACE statement creates a permanent tablespace called tbs_perm_01 that has one data
file called tbs_perm_01.dat.
The following is a CREATE TABLESPACE statement that creates a permanent tablespace that will extend
when more space is required:
CREATE TABLESPACE tbs_perm_02
DATAFILE 'tbs_perm_02.dat'
SIZE 10M
REUSE
AUTOEXTEND ON NEXT 10M MAXSIZE 200M;
This CREATE TABLESPACE statement creates a permanent tablespace called tbs_perm_02 that has one data
file called tbs_perm_02.dat. When more space is required, 10M extents will automatically be added until
200MB is reached.
The following is a CREATE TABLESPACE statement that creates a BIGFILE permanent tablespace that will
extend when more space is required:
CREATE BIGFILE TABLESPACE tbs_perm_03
DATAFILE 'tbs_perm_03.dat'
SIZE 10M
AUTOEXTEND ON;
This CREATE TABLESPACE statement creates a BIGFILE permanent tablespace called tbs_perm_03 that has
one data file called tbs_perm_03.dat.
5.3 Create user
The Oracle create user command is used to create database user accounts. When creating a user account with
the Oracle create user command you can:
Here is an example of the use of the create user command:
CREATE USER myuser IDENTIFIED BY password
DBMS

KTM BIKE SHOWROOM MANAGMENT

DEFAULT TABLESPACE users


TEMPORARY TABLESPACE temp
In this example we have used the Oracle create user command to create a user called MYUSER. We use the
identified by clause to define the password, which is password in this case. Next we use the default tablespace
keyword to define the location of the default tablespace, which is USERS. The temporary tablespace keyword
defines the temporary tablespace that will be assigned to the user, which in our case is the TEMP tablespace.
5.4 Grant
SQL GRANT is a command used to provide access or privileges on the database objects to the users.
The Syntax for the GRANT command is:
GRANT privilege_name
ON object_name
TO {user_name |PUBLIC |role_name}
[WITH GRANT OPTION];
privilege_name is the access right or privilege granted to the user. Some of the access rights are ALL,
EXECUTE, and SELECT.
object_name is the name of an database object like TABLE, VIEW, STORED PROC and SEQUENCE.
user_name is the name of the user to whom an access right is being granted.
user_name is the name of the user to whom an access right is being granted.
PUBLIC is used to grant access rights to all users.
ROLES are a set of privileges grouped together.
WITH GRANT OPTION - allows a user to grant access rights to other users.
For Example: GRANT SELECT ON employee TO user1;This command grants a SELECT permission on
employee table to user1.You should use the WITH GRANT option carefully because for example if you
GRANT SELECT privilege on employee table to user1 using the WITH GRANT option, then user1 can
GRANT SELECT privilege on employee table to another user, such as user2 etc. Later, if you REVOKE the
SELECT privilege on employee from user1, still user2 will have SELECT privilege on employee table.

SQL REVOKE Command


The REVOKE command removes user access rights or privileges to the database objects.
The Syntax for the REVOKE command is:
REVOKE privilege_name
ON object_name
FROM {user_name |PUBLIC |role_name}

DBMS

KTM BIKE SHOWROOM MANAGMENT

For Example: REVOKE SELECT ON employee FROM user1;This command will REVOKE a SELECT
privilege on employee table from user1.When you REVOKE SELECT privilege on a table from a user, the user
will not be able to SELECT data from that table anymore. However, if the user has received SELECT privileges
on that table from more than one users, he/she can SELECT from that table until everyone who granted the
permission revokes it. You cannot REVOKE privileges if they were not initially granted by you.
5.5 Locking
Database locks are used to provide concurrency control in order to ensure data consistency and integrity.
Common uses of locks are:
ensure that only one user can modify a record at a time;
ensure that a table cannot be dropped while another user is querying it;
ensure that one user cannot delete a record while another is updating it.
Syntax:
LOCK TABLE tablename IN <lockmode> MODE [NOWAIT]
lockmodes:
EXCLUSIVE
SHARE
ROW EXCLUSIVE
SHARE ROW EXCLUSIVE
If NOWAIT is omitted Oracle will wait until the table is available.
Several tables can be locked with a single command - separate with commas
e.g.LOCK TABLE table1,table2,table3 IN ROW EXCLUSIVE MODE;

DBMS

KTM BIKE SHOWROOM MANAGMENT

10

KTM BIKE SHOWROOM MANAGEMENT

1.1Abstract (Overview)
This project is Entitled as KTM Bike showroom management system
developed using VB.net as a Front End and Mysql as a Back End. This project is ideal for dealers
or resellers of any size. The Bike showroom control panel can be access anywhere in any time.
Bike showroom management system describes the complete process of selling a Bike and also
the Staff management.
KTM Bike Showroom Management system will provide the
showroom managing in much easier fashion. The modules are they can manage the Bike booking
system , services stock information in the showroom and also the staff details . The Bike booking
system will be done by the admin and managing also they will set the delivery date of the bike
and the order will complete in the current date . And In the Service module also admin will take
care of that admin will assign a staff for a bike in the service managing. In the showroom
management the admin will take care of the bike stock details and the Adding Updating Deleting
of the bikes.

1.2 Objectives of the System

The purpose of this application is to design a system to maintain the information related to
a Bike Showroom.
The objective of this application is to design a system to maintain the information related
to a Bike Showroom. The purpose is to maintain a centralized repository of information
about all activities regarding a showroom.
It is User Friendly and Secure the Data.
Can easily make the daily reports.
It will simplifies the task and reduce the paper work.
During implementation every user will be given appropriate training to suit their specific
needs.

1.3 Advantages Of KTM Bike Showroom Management System


The following are the objectives and highlights of the proposed system
Secure data
DBMS

10

KTM BIKE SHOWROOM MANAGMENT

11

Faster process
User Friendly
Better management
Save a lot of manpower
Can easily make the daily reports
Elimination of Paper work,
High reliability and security.
Fast and economical.

1.4 Limitations of the Existing System

Manual entry consumes more time.


It is difficult to maintain bulk of record in manual.
Restrictions in the users.
Not easy to prepare the daily reports.
Lack of accuracy and error prone.
Overall efficiency is less.
Lot of paper work.
Non-secure.
No perfect maintenance of report.
No method to trace details
Human errors
The manual system is too slow
Searching is more time consuming

DBMS

11

KTM BIKE SHOWROOM MANAGMENT

12

1.5 Hardware and software Configuration

Hardware:

Processor

Intel Pentium or more

Ram

256 MB or more

Cache

512 KB

Hard disk

16 GB hard disk recommended for primary partition

Software:

Operating system

All editions: Windows XP or later or windows

Front End Software

Visual Basic.NET

Backend Software

Mysql

4. SYSTEM DESIGN
Modules Design

Login Module
Booking Module
Bike Module
Service Module
Staff Module

Module Description
Login Module
This module deals with authentication to the application. The user can login to the
application by entering the username and password.
Booking Module

DBMS

12

KTM BIKE SHOWROOM MANAGMENT

13

This module deals with the booking add new booking and set the delivery date etc
managed by the admin . Also deals with the update and the delete operation for the booking.
Bike Module

This module deals with Bike managing the stock details also managed by the
admin . Also bike module is also delas with update delete operations for the booking.

Service Module
This module deals with the service section to service the bike it will need to register
by the admin , admin will set a staff for each service. And also the update and delete option will
be there.
Staff Module
This modules deals with the staff details admin will manage the adding updating
deleting.

Database Design
1. Login Table Design

2. Staff Table Design

3. Service Table Design

DBMS

13

KTM BIKE SHOWROOM MANAGMENT

14

4. Booking Table Design

5. Bike table Design

User Interface Design


Login Page :

DBMS

14

KTM BIKE SHOWROOM MANAGMENT

15

This Login page provides the validation to an admin. The user can access the application by entering username
and password.
Source Code :
Imports System.Data
Imports MySql.Data.MySqlClient
Public Class login
Private Sub Label1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Label1.Click
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then
MsgBox("Enter the username")
ElseIf TextBox2.Text = "" Then
MsgBox("Enter password")
End If
Dim com As String
com = "select name,pass from admin_log where name = '" + TextBox1.Text + "' ;"
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"
Dim pwd As String
If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2}; database={3}; pooling=false",
server, userName, password, DatabaseName)
Try
conn.Open()
Dim adp As MySqlDataAdapter = New MySqlDataAdapter(com, conn)
Dim ds As DataSet = New DataSet()
adp.Fill(ds)
If ds.Tables(0).CreateDataReader.HasRows Then
DBMS

15

KTM BIKE SHOWROOM MANAGMENT

16

pwd = ds.Tables(0).Rows(0)(1)
If pwd = TextBox2.Text Then
MsgBox("Welcome")
MDIParent1.Show()
Me.Hide()
Else
MsgBox("Invalid Login")
End If
' fname.Text = ds.Tables(0).Rows(0)(1)
'welcom.Show()
'Me.Hide()
Else
MsgBox("No Data Found")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub
End Class

Home Page

DBMS

16

KTM BIKE SHOWROOM MANAGMENT

17

Bike Adding Form

Source Code :
Imports System.Data
Imports MySql.Data.MySqlClient
Public Class bike_ktm
DBMS

17

KTM BIKE SHOWROOM MANAGMENT

18

Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click


Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"
Dim comm As New MySqlCommand
If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2}; database={3}; pooling=false",
server, userName, password, DatabaseName)
Try
conn.Open()
comm.Connection = conn
comm.CommandText = "insert into bike_ktm values(" + bik_id.Text + " , '" + bik_mod.Text + "', " + bik_pri.Text
+ ", '" + bik_spe.Text + "','" + bik_sto.Text + "')"
comm.ExecuteNonQuery()
MsgBox("Bike Added")
Me.Hide()
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub
Private Sub Clear_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Clear.Click
Dim a As Control
For Each a In Me.Controls
If TypeOf a Is TextBox Then
a.Text = Nothing
End If
If TypeOf a Is ComboBox Then
a.Text = Nothing
End If
Next
End Sub
End Class

DBMS

18

KTM BIKE SHOWROOM MANAGMENT

19

Staff Adding Form

Source Code :
Imports System.Data
Imports MySql.Data.MySqlClient
Public Class staff_ktm

DBMS

19

KTM BIKE SHOWROOM MANAGMENT


20
Private Sub submit_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Submit.Click
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"
Dim comm As New MySqlCommand
If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
comm.Connection = conn
comm.CommandText = "insert into staff_ktm values(" + sta_id.Text + ", '" +
sta_name.Text + "', '" + sta_add.Text + "','" + sta_gen.Text + "')"
comm.ExecuteNonQuery()
MsgBox("Staff Added")
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim a As Control
For Each a In Me.Controls
If TypeOf a Is TextBox Then
a.Text = Nothing
End If
Next
DBMS

20

KTM BIKE SHOWROOM MANAGMENT

21

End Sub
Private Sub staff_ktm_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
End Sub
End Class

Booking Form

Source Code :
Imports System.Data
Imports MySql.Data.MySqlClient
Public Class book_add
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
DBMS

21

KTM BIKE SHOWROOM MANAGMENT

22

Dim conn As New MySqlConnection


Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"
Dim comm As New MySqlCommand
If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
comm.Connection = conn
comm.CommandText = "insert into booking_ktm values(" + book_id.Text + ", '" +
fname.Text + "', '" + email.Text + "', " + phone.Text + ", '" + address.Text + "', '" + proof.Text +
"','" + model.Text + "'," + price.Text + ",'" + bdate.Value.ToString("yyyy-M-dd") + "','" +
ddate.Value.ToString("yyyy-M-dd") + "','" + status.Text + "'," + staff_id.Text + ")"
comm.ExecuteNonQuery()
MsgBox("Booking Added")
Me.Hide()
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub
Private Sub book_add_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Dim com As String
com = "select staff_id from staff_ktm;"
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
DBMS

22

KTM BIKE SHOWROOM MANAGMENT

23

Dim userName As String = "root"


Dim password As String = "jagan"
Dim comm As New MySqlCommand
If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
Dim adp As MySqlDataAdapter = New MySqlDataAdapter(com, conn)
Dim i As Integer
Dim ds As DataSet = New DataSet()
adp.Fill(ds)
i=0
While i < ds.Tables(0).Rows.Count
staff_id.Items.Add(ds.Tables(0).Rows(i)(0))
i=i+1
End While
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub
Private Sub staff_id_SelectedIndexChanged(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles staff_id.SelectedIndexChanged
End Sub

Private Sub Button2_Cltick(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
Dim a As Control
For Each a In Me.Controls
DBMS

23

KTM BIKE SHOWROOM MANAGMENT

24

If TypeOf a Is TextBox Then


a.Text = Nothing
End If
Next

End Sub
End Class
Service Form

Source Code :
Imports System.Data
Imports MySql.Data.MySqlClient
Public Class service_ktm
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim conn As New MySqlConnection
DBMS

24

KTM BIKE SHOWROOM MANAGMENT

25

Dim DatabaseName As String = "ktm"


Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"
Dim comm As New MySqlCommand
If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
comm.Connection = conn
comm.CommandText = "insert into service_ktm values(" + ser_id.Text + ", '" +
ser_mod.Text + "', '" + ser_reg.Text + "', '" + ser_own.Text + "', '" + ser_pro.Text + "', '" +
ser_dat.Value.ToString("yyyy-M-dd") + "','" + ser_del.Value.ToString("yyyy-M-dd") + "')"
comm.ExecuteNonQuery()
MsgBox("Booking Added")
Me.Hide()

Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
Dim a As Control
For Each a In Me.Controls
If TypeOf a Is TextBox Then
a.Text = Nothing
DBMS

25

KTM BIKE SHOWROOM MANAGMENT

26

End If
Next
End Sub
End Class

Staff Search , Update , Delete Form

Source Code :
Private Sub Button1_Click(ByVal
System.EventArgs) Handles Button1.Click

sender

As

System.Object,

ByVal

As

Dim com As String


com = "select staff_id,staff_name,staff_address,staff_gender from staff_ktm where staff_id =
'" + cid.Text + "' ;"
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
DBMS

26

KTM BIKE SHOWROOM MANAGMENT

27

Dim userName As String = "root"


Dim password As String = "jagan"
Dim comm As New MySqlCommand
If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
Dim adp As MySqlDataAdapter = New MySqlDataAdapter(com, conn)
Dim ds As DataSet = New DataSet()
adp.Fill(ds)
If ds.Tables(0).CreateDataReader.HasRows Then

sta_na.Text = ds.Tables(0).Rows(0)(1)
sta_add.Text = ds.Tables(0).Rows(0)(2)
sta_gen.Text = ds.Tables(0).Rows(0)(3)

Else
MsgBox("No Data Found")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button2.Click
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
DBMS

27

KTM BIKE SHOWROOM MANAGMENT

28

Dim userName As String = "root"


Dim password As String = "jagan"

Dim com As New MySqlCommand


If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
com.Connection = conn
com.CommandText = "delete from staff_ktm where staff_id = '" + cid.Text + "';"
com.ExecuteNonQuery()
MsgBox("Deleted")
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"

Dim com As New MySqlCommand


If Not conn Is Nothing Then conn.Close()
DBMS

28

KTM BIKE SHOWROOM MANAGMENT


29
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
com.Connection = conn
com.CommandText = "update staff_ktm set staff_name = '" + sta_na.Text + "' ,
staff_address = '" + sta_add.Text + "' , staff_gender = '" + sta_gen.Text + "' where staff_id = '" +
cid.Text + "';"
com.ExecuteNonQuery()
MsgBox("Updated")
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button4.Click
Dim a As Control
For Each a In Me.Controls
If TypeOf a Is TextBox Then
a.Text = Nothing
End If
Next
End Sub
End Class

DBMS

29

KTM BIKE SHOWROOM MANAGMENT

30

Service Update , Delete , Form

Source Code :
Private Sub Button1_Click(ByVal
System.EventArgs) Handles Button1.Click

sender

As

System.Object,

ByVal

As

Dim com As String


com
=
"select
service_id,service_modelname,service_regnum,service_ownername,service_problem,
(time_format(service_date, '%h %i %s')),(time_format(service_delivarydate, '%h %i %s')) from
service_ktm where service_id = '" + cid.Text + "' ;"
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"
Dim comm As New MySqlCommand
DBMS

30

KTM BIKE SHOWROOM MANAGMENT


If Not conn Is Nothing Then conn.Close()

31

conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};


database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
Dim adp As MySqlDataAdapter = New MySqlDataAdapter(com, conn)
Dim ds As DataSet = New DataSet()
adp.Fill(ds)
If ds.Tables(0).CreateDataReader.HasRows Then

modelname.Text = ds.Tables(0).Rows(0)(1)
regnum.Text = ds.Tables(0).Rows(0)(2)
ownername.Text = ds.Tables(0).Rows(0)(3)
problem.Text = ds.Tables(0).Rows(0)(4)
dat.Text = ds.Tables(0).Rows(0)(5)
ddate.Text = ds.Tables(0).Rows(0)(6)

Else
MsgBox("No Data Found")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub
Private Sub service_view_Load(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles MyBase.Load
Dim com As String
com = "select service_id from service_ktm;"

DBMS

31

KTM BIKE SHOWROOM MANAGMENT

32

Dim conn As New MySqlConnection


Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"
Dim comm As New MySqlCommand
If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
Dim adp As MySqlDataAdapter = New MySqlDataAdapter(com, conn)
Dim i As Integer
Dim ds As DataSet = New DataSet()
adp.Fill(ds)
i=0
While i < ds.Tables(0).Rows.Count
cid.Items.Add(ds.Tables(0).Rows(i)(0))
i=i+1
End While
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
DBMS

32

KTM BIKE SHOWROOM MANAGMENT

33

Dim conn As New MySqlConnection


Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"

Dim com As New MySqlCommand


If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
com.Connection = conn
com.CommandText = "delete from service_ktm where service_id = '" + cid.Text + "';"
com.ExecuteNonQuery()
MsgBox("Deleted")
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"
DBMS

33

KTM BIKE SHOWROOM MANAGMENT

34

Dim com As New MySqlCommand


If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
com.Connection = conn
com.CommandText = "update service_ktm set service_modelname = '" +
modelname.Text + "' , service_regnum = '" + regnum.Text + "' , service_ownername = '" +
ownername.Text + "', service_problem = '" + problem.Text + "', service_date = '" +
dat.Value.ToString("yyyy-M-dd") + "', service_delivarydate = '" + ddate.Value.ToString("yyyy-Mdd") + "' where service_id = '" + cid.Text + "';"
com.ExecuteNonQuery()
MsgBox("Updated")
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button4.Click
Dim a As Control
For Each a In Me.Controls
If TypeOf a Is TextBox Then
a.Text = Nothing
End If
If TypeOf a Is ComboBox Then
a.Text = Nothing

DBMS

34

KTM BIKE SHOWROOM MANAGMENT

35

End If
Next
End Sub

Private Sub ddate_ValueChanged(ByVal


System.EventArgs) Handles ddate.ValueChanged

sender

As

System.Object,

ByVal

As

As

End Sub
End Class
Booking Update , Delete Form

Source Code :
Private Sub Button1_Click(ByVal
System.EventArgs) Handles Button1.Click

sender

As

System.Object,

ByVal

Dim com As String


com
=
"select
book_id,book_name,book_email,book_phone,book_address,book_proof,book_model,book_price,

DBMS

35

KTM BIKE SHOWROOM MANAGMENT


(time_format(book_bookdate,
'%h
%i
%s')),(time_format(book_delivarydate,
%s')),book_status,book_staffid from booking_ktm where book_id = '" + cid.Text + "' ;"

'%h

36
%i

Dim conn As New MySqlConnection


Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"
Dim comm As New MySqlCommand
If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
Dim adp As MySqlDataAdapter = New MySqlDataAdapter(com, conn)
Dim ds As DataSet = New DataSet()
adp.Fill(ds)
If ds.Tables(0).CreateDataReader.HasRows Then

b_name.Text = ds.Tables(0).Rows(0)(1)
b_email.Text = ds.Tables(0).Rows(0)(2)
b_phone.Text = ds.Tables(0).Rows(0)(3)
b_address.Text = ds.Tables(0).Rows(0)(4)
b_idp.Text = ds.Tables(0).Rows(0)(5)
b_mod.Text = ds.Tables(0).Rows(0)(6)
b_price.Text = ds.Tables(0).Rows(0)(7)
b_bdat.Text = ds.Tables(0).Rows(0)(8)
b_del.Text = ds.Tables(0).Rows(0)(9)
b_status.Text = ds.Tables(0).Rows(0)(10)
b_staff.Text = ds.Tables(0).Rows(0)(11)
Else
DBMS

36

KTM BIKE SHOWROOM MANAGMENT

37

MsgBox("No Data Found")


End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click

Dim conn As New MySqlConnection


Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"

Dim com As New MySqlCommand


If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
com.Connection = conn
com.CommandText = "delete from booking_ktm where book_id = '" + cid.Text + "';"
com.ExecuteNonQuery()
MsgBox("Deleted")
Catch ex As Exception
MsgBox(ex.Message)
DBMS

37

KTM BIKE SHOWROOM MANAGMENT

38

End Try
conn.Close()

End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"

Dim com As New MySqlCommand


If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
com.Connection = conn
com.CommandText = "update booking_ktm set book_name = '" + b_name.Text + "' ,
book_email = '" + b_email.Text + "' , book_phone = '" + b_phone.Text + "', book_address = '" +
b_address.Text + "', book_proof = '" + b_idp.Text + "', book_model = '" + b_mod.Text + "',
book_price = '" + b_price.Text + "', book_bookdate = '" + b_bdat.Value.ToString("yyyy-M-dd") +
"', book_delivarydate = '" + b_del.Value.ToString("yyyy-M-dd") + "' where book_id = '" + cid.Text
+ "';"
com.ExecuteNonQuery()
MsgBox("Updated")
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
DBMS

38

KTM BIKE SHOWROOM MANAGMENT

39

End Sub

Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button4.Click
Dim a As Control
For Each a In Me.Controls
If TypeOf a Is TextBox Then
a.Text = Nothing
End If
Next
End Sub

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


System.EventArgs) Handles b_address.TextChanged

End Sub
End Class

Bike Update , Delete Form

DBMS

39

KTM BIKE SHOWROOM MANAGMENT

40

Source Code :
Private Sub search_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles
search.Click
Dim com As String
com = "select bike_id,bike_model,bike_price,bike_specification,bike_stock from bike_ktm
where bike_id = '" + cid.Text + "' ;"
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"
Dim comm As New MySqlCommand
If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
DBMS

40

KTM BIKE SHOWROOM MANAGMENT


Dim adp As MySqlDataAdapter = New MySqlDataAdapter(com, conn)

41

Dim ds As DataSet = New DataSet()


adp.Fill(ds)
If ds.Tables(0).CreateDataReader.HasRows Then

model.Text = ds.Tables(0).Rows(0)(1)
price.Text = ds.Tables(0).Rows(0)(2)
spec.Text = ds.Tables(0).Rows(0)(3)
stock.Text = ds.Tables(0).Rows(0)(4)
Else
MsgBox("No Data Found")
End If
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"

Dim com As New MySqlCommand


If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
DBMS

41

KTM BIKE SHOWROOM MANAGMENT

42

conn.Open()
com.Connection = conn
com.CommandText = "delete from bike_ktm where bike_id = '" + cid.Text + "';"
com.ExecuteNonQuery()
MsgBox("Deleted")
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()

End Sub

Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button2.Click
Dim conn As New MySqlConnection
Dim DatabaseName As String = "ktm"
Dim server As String = "localhost"
Dim userName As String = "root"
Dim password As String = "jagan"

Dim com As New MySqlCommand


If Not conn Is Nothing Then conn.Close()
conn.ConnectionString = String.Format("server={0}; user id={1}; password={2};
database={3}; pooling=false", server, userName, password, DatabaseName)
Try
conn.Open()
com.Connection = conn
com.CommandText = "update bike_ktm set bike_model = '" + model.Text + "' , bike_price
= '" + price.Text + "' , bike_specification = '" + spec.Text + "', bike_stock = '" + stock.Text + "'
where bike_id = '" + cid.Text + "';"
com.ExecuteNonQuery()
DBMS

42

KTM BIKE SHOWROOM MANAGMENT

43

MsgBox("Updated")
Catch ex As Exception
MsgBox(ex.Message)
End Try
conn.Close()
End Sub

Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)


Handles Button3.Click
Dim a As Control
For Each a In Me.Controls
If TypeOf a Is TextBox Then
a.Text = Nothing
End If
Next
End Sub
End Class

Conclusion
This project is used to provide the easier management of a Bike showroom system. Admin Can
manage the entire showroom from this software. This System will convert all the manual work to
the computerized work , the admin can easily get more information which they want.
The Software includes Booking , Bike , Service , Staff
Modules Plus their updation deleting managing can be done by the admin i will reduce the paper
work on a Showroom data will never lose.

DBMS

43

Вам также может понравиться