0% found this document useful (0 votes)
341 views

Bus Root and Timing Display System

This project is a bus route and timing display system developed in PHP and MySQL. It allows passengers to search for bus details like routes, fares, and schedules between locations. When a user enters a starting and ending place, the system displays the area names, available buses, fares, number of stops, and nearby landmarks. It has modules for admin login, bus route information, driver/conductor details, customer registration and login. The system aims to address issues like passengers not knowing bus availability or timings. It provides secure, real-time bus details to users from any location.

Uploaded by

Keerthi Vasan L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
341 views

Bus Root and Timing Display System

This project is a bus route and timing display system developed in PHP and MySQL. It allows passengers to search for bus details like routes, fares, and schedules between locations. When a user enters a starting and ending place, the system displays the area names, available buses, fares, number of stops, and nearby landmarks. It has modules for admin login, bus route information, driver/conductor details, customer registration and login. The system aims to address issues like passengers not knowing bus availability or timings. It provides secure, real-time bus details to users from any location.

Uploaded by

Keerthi Vasan L
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 35

BUS ROOT AND TIMING DISPLAY SYSTEM

ABSTRACT

This project is entitled as “bus root and timing display system” which has developed in PHP as
front end mysql server as backend. This project specially developed for all passengers. When the
passenger want to travel city to village or village to particular area in city did not know the bus
available details. It’s big problem for all passengers.

In this project contain the details about all area names, available buses, fare and land mark. Once
the passenger or user register in this website. Anywhere and anytime the user is able to access
the bus route details.

When the user gives the starting and reaching place (area name) the project will display the area
name, available buses, bus fare amount, and number of stops, near land mark details.

MODULES DESIGN

Admin login:

This module contains the details about the admin login details such as admin name and
password.

Bus root information:

This module contains the details about the bus root information such as bus number, from place,
to place, number of stops, stops names, timing details and ticket fair amount.

Driver and conductor information:

This module contains the details about the driver and conductor information such as driver name,
conductor name, shifts timing, bus number, from place and to place.

Customer registration:
This module contains the details about the customer registration such as customer name, id,
password, address, phone number and mail id.

Customer login:

This module contains the details about the customer login such as customer name and password.

Existing system:

Existing system contain the many drawbacks. The person does not know the all available bus
details. When the passenger want to travel city to village or village to particular area in city did
not know the bus available details. It’s big problem for all passengers.

Drawback:

 Does not know the bus details


 Timing problem
 Does not know the stops

Proposed system:

This project specially developed for all passengers. When the passenger want to travel city to
village or village to particular area in city did not know the bus available details. It’s big problem
for all passengers.

When the user enter the from place to reaching place(area name) after the project will display the
area name, available buses, bus fair amount, number of stops, near land mark details.

Advantages:

 All bus details are displayed


 Driver and conductor details are displayed
 Secured system
 Display number of staffs

3. SYSTEM SPECIFICATION

3.1 HARDWARE CONFIGURATION

Platform : Windows 7

System : dual core processor

Ram : 512MB

Hard disk : 80GB

3.2 SOFTWARE SPECIFICATION

Web server : WAMP Server

Beck end : MYSQL

Server side scripting : PHP

Client side scripting : HTML

Designing Tools : Dreamweaver


SOFTWARE SPECIFICATION

HTML (HYPERTEXT MARKUP LANGUAGE)

HTML stands for Hypertext Markup Language, and it is the language in which, until


recently, virtually all Web pages were written. Now, don’t break out in hives when you hear the
word “language.” You don’t need complex logical or mathematical formulas to work with
HTML, and you don’t need to think like a programmer to use it.

Hypertext refers to the way in which Web pages (HTML documents) are linked together.
When you click a link in a Web page, you are using hypertext. It is this system of linking
documents that has made the World Wide Web the global phenomenon it has become. Markup
Language describes how HTML works. With a markup language, you simply “mark up” a text
document with tags that tell a Web browser how to structure it. HTML originally was developed
with the intent of defining the structure of documents (headings, paragraphs, lists, and so forth)
to facilitate the sharing of scientific information between researchers.

FOUR KEY CONCEPTS:

The first step toward understanding and working with HTML is learning the basic terms
that describe most of the functions of this language. You will come across these terms repeatedly
as you use HTML and if you understand them, you will have progressed a long way toward
comprehending HTML, not to mention XHTML.

ELEMENTS
All HTML pages are made up of elements. Think of an element as a container in which a
portion of a page is placed. Whatever is contained inside the element will take on the
characteristics of that element. For example, to identify a heading on a page, you would enclose
it in a heading element <h1> </h1>. If you want to create a table, you put the table information
inside the table element <table> </table>. To construct a form, you need the form element
<form> </form>.
TAGS
Often, you’ll find the terms element and tag used interchangeably. It’s fairly common,
but not strictly accurate. An element is made up of two tags: an opening tag and a closing tag.
Although it might seem somewhat picky to make this distinction, when you begin to work with
XHTML (Extensible Hypertext Markup Language), it will be a very important difference to
remember.
All tags are constructed the same way. The tag begins with a “less than” sign (<), then the
element name, followed by a “greater than” sign (>). For example, an opening tag for
the paragraph element would look like this: <p>. The only difference in a closing tag is that the
closing tag includes a slash (/) before the element name: </p>. Your content goes between the
tags. A simple paragraph might look like this :<p>this is an HTML paragraph. </p>
Some elements do not use closing tags because they do not enclose content. These are
called empty elements. For example, the line break element <br> does not require a closing tag.
In the case of empty elements, add a closing slash after the element name, like this: <br />. When
a browser sees the slash, it will recognize the element as one that does not need a separate,
closing tag.

PHP

PHP is a server-side scripting language designed for web development but also used as


a general-purpose programming language. As of January 2013, PHP was installed on more than
240 million websites (39% of those sampled) and 2.1 million web servers. Originally created
by Rasmus Lerdorf in 1995, the reference implementation of PHP is now produced by The PHP
Group. While PHP originally stood for Personal Home Page, it now stands for PHP: Hypertext
Preprocessor, a recursive backronym.

PHP code is interpreted by a web server with a PHP processor module, which generates
the resulting web page: PHP commands can be embedded directly into an HTML source
document rather than calling an external file to process data. It has also evolved to include
a command-line interface capability and can be used in standalone graphical applications.PHP
is free software released under the PHP License. PHP can be deployed on most web servers and
also as a standalone shell on almost every operating and platform, free of charge.

MYSQL

MySQL is the world's most popular open source database software, with over 100 million
copies of its software downloaded or distributed throughout its history. With its superior speed,
reliability, and ease of use, MySQL has become the preferred choice for Web, Web 2.0, SaaS,
ISV, Telecom companies and forward-thinking corporate IT Managers because it eliminates the
major problems associated with downtime, maintenance and administration for modern, online
applications.

Many of the world's largest and fastest-growing organizations use MySQL to save time and
money powering their high-volume Web sites, critical business systems, and packaged software
including industry leaders such as Yahoo!, Alcatel-Lucent, Google, Nokia, YouTube, Wikipedia,
and Booking.com.

The flagship MySQL offering is MySQL Enterprise, a comprehensive set of Vehicleion-


tested software, proactive monitoring tools, and premium support services available in an
affordable annual subscription. MySQL is a key part of LAMP (Linux, Apache, MySQL, PHP /
Perl / Python), the fast-growing open source enterprise software stack.
CHAPTER 4

4. SYSTEM DESIGN

4.1 INPUT DESIGN

Input design process is to design the various inputs needed into a machine-oriented
format. The main objective is to create an input layout that is easy to follow and to avoid
operator errors. The design phase includes designing of various input files used to develop the
system. Separate master data and entries has been developed and designed in this phase. Master
file contains relatively permanent details while the transaction files contain temporary details that
are updated in regular interval of time. The entry forms used are Customer details entry, Area
details entry, Parking entry and billing entry.

4.2 OUTPUT DESIGN

Computer output is the most important and direct source of information to the user.
Efficient intelligible output design should improve the system's relationship with the user and
health in decision-making.

Output design generally refers to the results generated by the system. For many end users
on the basis of the output the evaluate the usefulness of the application. Efficient software must
be able to produce and efficient effective reports.
Data flow diagram

Level-0

Send request receive


Bust root & timing response
User display system Admin

Receive details send res ponse


Level-1

Register the details store details


Register
New user Reg_tb

Login the page

Provide permission store details


Provide login Log_tb
authentication
Admin

Search bus details

Bus_tb
Update details
Bus details

ER diagram:
Name

Id pwd
Id Pwd

User Register
Register

B_no start

Root details

Search
Bus details
Root Id

from

Time 1
Root Id timing details
Time 2
Root details
Time 3

B_no start Time 4


Table design:

Table name: new user register

Primary key: uid

Field name Data type size description


uid varchar 5 User id
uname text 10 User name
pwd varchar 10 password
address varchar 50 address
Email varchar 30 Email id
Phnum number 12 Phone number

Table name: login

Foreign key: uid

Field name Data type size description


uid varchar 5 User id
pwd varchar 10 password

Table name: bus details

Primary key: busnum

Foreign key: dvrid, conid

Field name Data type size description


busnum varchar 10 Bus number
splace text 30 Starting place
eplace text 30 Ending place
nstops integer 20 Number of stops
sname text 50 Stops name
cost float 3,2 Bus ticket amount
dvrid varchar 5 Driver id
dvrname text 30 Driver name
conid varchar 5 Conductor id
conname text 30 Conductor name

Table name: driver details

Primary key: dvrid

Field name Data type size description


dvrid varchar 5 Driver id
dvrname text 30 Driver name
address varchar 50 address
phnum number 12 Phone number

Table name: conductor details

Primary key: conid

Field name Data type size description


conid varchar 5 Conductor id
conname text 30 Conductor name
address varchar 50 address
phnum number 12 Phone number

Screen shot:
SYSTEM TESTING AND IMPLEMENTATION

SYSTEM TESTING

It is the process of exercising software with the intent of finding and ultimately
correcting errors. This fundamental philosophy does not change for web applications,
because web based system and applications reside on network and inter-operate with
many different operating systems, browsers, hardware platforms and communication
protocols. Thus searching for errors is significant challenge for web applications.

Testing issues:

 Client GUI should be considered.


 Target environment and platform considerations
 Distributed database considerations
 Distributed processing consideration

TESTING METHODLOGIES

System testing is the state of implementation, which is aimed at ensuring that the
system works accurately and efficiently as expect before live operation, commences. It
certifies that the whole set of programs hang together System testing requires a test plan,
that consists of several key activities and steps for run program, string, system and user
acceptance testing. The implementation of newly design package is important in adopting
a successful new system
Testing is important stage in software development. System test is
implementation should be a confirmation that all is correct and an opportunity to show
the users that the system works as they expected It accounts the largest percentage of
technical effort in software development process.

Testing phase is the development phase that validates the code against the
functional specifications. Testing is a vital to the achievement of the system goals. The
objective of testing is to discover errors. To fulfill this objective a series of test step such
as the unit test, integration test, validation and system test where planned and executed.

Unit testing

The four categories of test that a programmer will typically perform on a


program unit Here each program is tested individually so any error apply unit is
debugged. The sample data are given for the unit testing. The unit test results are
recorded for further references. During unit testing the functions of the program unit
validation and the limitations are tested.

Unit testing is testing changes made in a existing or new program this test is
carried out during the programming and each module is found to be working
satisfactorily. For example in the registration form after entering all the fields we click
the submit button. When submit button is clicked, all the data in form are validated. Only
after validation entries will be added to the database.

Unit testing comprises the set of tests performed by an individual prior to


integration of the unit into large system. The situation is illustrated in as follows

Coding-> Debugging ->Unit testing -> Integration testing


 Functional test
 Performance test
 Stress Test
 Structure test

Functional test involve exercising the code with nominal input values for
which the expected results are known as well as boundary values and special values.

Performance testing determines the amount of execution time spent in


various parts of unit program through put and response time and device utilization by the
program.

A variation of stress testing called sensitivity testing in same situations a


very small range of data contained in a the bounds of valid data may cause extreme and
even erroneous processing or profound performance degradation.

Structured testing is concerned with a exercising the internal logic of a


program and traversing paths. Functional testing, stress testing performance testing are
referred as “black box” testing and structure testing is referred as “white box” testing

Example: the unit testing performed in the registration module. All the data
are correctly passed to the form then stored in the database.

VALIDATION TESTING
Software validation is achieved through a serious of testes that demonstrate
conformity with requirements. Thus the proposed system under consideration has been
tested by validation & found to be working satisfactory.

Example: the age allowed the valid data (age value) only.

OUTPUT TESTING

Asking the user about the format required by them tests the output generated
by the system under consideration .It can be done in two ways, One on screen and other
on printer format. The output format on the screen is found to be correct as the format
designed n system test.

Example: this testing performed on the registration page. The input data are
stored in the correct database. Expected output is displayed on the screen. Register
successfully message displayed on the screen.

SYSTEM TESTING

In the system testing the whole system is tested for interface


between each module and program units are tested and recorded. This
testing is done with sample data. The securities, communication between
interfaces are tested

System testing is actually a series of different tests whose


primary purpose is to fully exercise the computer based system although
each test has a different purpose all work to verify that all system
elements properly integrated and perform allocate function.

It involves two kinds of activities namely


1. Integrated testing

2. Acceptance testing

Integrated testing

Integrated testing is a systematic technique for constructing tests to uncover


errors associated with interface.

Objective is to take unit tested modules and build a program structure that
has been dictated by design

Acceptance testing

Acceptance testing involves planning an execution of a functional test,


performance test and stress test to verify that the implemented system satisfies the
requirement.

The acceptance testing is the final stage of the user the various possibilities
of the data are entered and the results are tested.

Validation testing
Software validation is achieved through a series of test that demonstrates the
conformity and requirements. Thus the proposed system under consideration has to be
tested by validation and found to be working satisfactorily. For example in customer
enters phone number field should contain number otherwise it produces an error message
similarly in all the forms the fields are validated

Testing results

All the tests should be traceable to customer requirements the focus of testing will
shift progressively from programs Exhaustive testing is not possible To be more effective
testing should be which has probability of finding errors

The following are the attributes of good test

1. A good test has a probability of finding a errors

2. A good test should be “best of breeds”

3. A good test to neither simple nor too complex

QUALITY ASSURANCE

Quality assurance consists of the auditing and reporting functions of management.


The goal of quality assurance is to provide management with the data entries necessary to
be informed about the product quality thereby gaining the goal of insight and confidence
that the product quality is meeting
Greater emphasis on quality in organization requires quality assurance. To be an
integral part of the information system development .The development process must
include checks throughout the process to ensure that the final product meets the original
user requirements.

Quality assurance thus becomes an important component of the development process

It’s included in the industry standard (IEEE 1993) On the development process quality
assurance process is integrated into a linear development cycle through validation and
verification performed at crucial system development steps .The goals of the management
is to institute and monitor a quality assurance program with in the development process

Quality assurance induces

1. Validation of the system against requirements

2. Checks for errors in design documents and in the system itself

3. Quality assurance for usability

Quality assurance Goals:

Correctness: The extent to which the program meets the system specifications and user
objectives

Reliability: The degree to which the system performs its intended functions overtime

Efficiency: The amount of computer resources required by a program to perform


a function
Usability: The effort required learning and operating a system

Maintainability: To use with which program errors are located and corrected

Testability: The effort required a testing a program to ensure its correct


performance

Portability: To ease of transporting a program from hardware configuration to another

Accuracy: The required position in input editing computation and output

GENERIC RISKS:

Risk identification is the systematic attempt to specify threats to the project plan
(estimates the schedule resource overloading etc.). By identifying know and predictable
risk the first step is to avoiding them. When possible and controlling them when
necessary there are two types of risks

 Generic Risk
 Product specific risk

Generic risks are potential threats to every software project. Only those with a
clear understanding of technology can identify product specific risk. The people and the
environment that is specific to the project at a hand and to identify the product specific
risk and the project the plan and the software statement of scope are examined and
answer to the following question is developed.

What special characteristics of this product may threaten the project plan one
method for identifying risk is to create a risk item and checklists. The checklist can be
used for risk identification and focus on some subset to know and predictable risk in the
following sub categories.
 Product risk
 Risk associated with overall size of software to built or modified
 Business imparts
 Risk associated with constraints imposed with management
 Customer characteristics

Risk associated with sophisticated of the customer and developers ability to communicate
with the customer in a timely manner.

Different categories of risks are considered

Project Risks
It identify a potential budgetary, schedule, personnel like staffing, organizing,
resource, customer requirement, problems and their impact on a software project

Technical risks
Technical risks identify potential design implementation interface, verification,
and maintenance problems.

SECURITY TECHNOLOGIES AND POLICIES

Any system developed should be secured & protected against possible hazards.
Security measures are provided to prevent unauthorized access to database at various
levels. Password protection & simple procedures to change the unauthorized access are
provided to the users.

The user will have to enter the user name and password and if it is validated he
can participate in auction. Otherwise if he/she is a new user he should get registered and
then he can place an order
When he/she registered they should provide authentication through jpg files (like
ration card Xerox, voter identity card Xerox). A multi layer security architecture
comprising firewalls filtering routers encryption & digital certification must be assured in
this project in real time that order details are protected from unauthorized access.

SYSTEM IMPLEMENTATION

Implementation is the stage in the project where the theoretical design is turned
into a working system. The most crucial stage is achieving a successful new system and
giving a user confidence in that the new system will work efficiently and effectively in
the implementation stage. The stage consist of

1. Testing a developed program with sample data

2. Detection and correction of error

3. Creating whether the system meets a user requirements

4. Making necessary changes as desired by users.

5. Training user personal

IMPLEMENTATION PROCEDURES

The implementation phase is less creative than system design. A system design
may be dropped at any time prior to implementation, although it becomes more difficult
when it goes to the design phase. The final report of the implementation phase includes
procedural flowcharts, record layouts, and a workable plan for implementing the
candidate system design into a operational design.

USER TRAINING

It is designed to prepare the users for testing & converting the system. There is
several ways to trail the users they are:

1) User manual

2) Help screens

3) Training demonstrations.

1) User manual:

The summary of important functions about the system & software can be
provided as a document to the user. User training is designed to prepare the user for
testing and convening a system

The summary of important functions about the system and the software can be provided
as a document to the user

1. Open http page


2. Type the file name with URL index .asp in the address bar
3. Index. ASP is opened existing user the type the username and
password
4. Click the submit button
2) Help screens:

This features now available in every software package, especially when it


is used with a menu. The user selects the “Help” option from the menu. The System
success the necessary description or information for user reference.

3) Training demonstration:

Another user training element is a training demonstration. Live demonstration with


personal contact is extremely effective for training users.

SYSTEM MAINTENANCE

Maintenance is actually implementation of the review plan as


important as it is programmers and analyst is to perform or identify with him or herself
with the maintenance. There are psychologically personality, and professional reasons for
this. Analyst and programmers spend fair more time maintaining programmer then they do
writing them Maintenances account for 50-80% of total system development. Maintenance
is expensive .One way to reduce the maintenance costs are through maintenance mgt and
software modification audits Types of maintenance are

1. Perfective maintenance

2. Preventive maintenance
BIBLIOGRAPHY

Books

 .Elias Awath, “SYSTEM ANALYSIS AND DESIGN”,Tata Mc Graw Hill Publication,


Sixth Edition,2003
 .S.Ramachandran,”COMPUTER AIDED DESIGN”, Air Walk Publication, Third
Edition,2003
 .Richard Fairley,”SOFTWARE ENGINEERING CONCEPTS”,Tata Mc Graw Hill
Publication, Second Edition,1997
Reference

http://www.homeandlearn.co.uk/NET/nets12p1.html

www.w3schools.com/ASP.Net

www.w3schools.com/VB.Net

www.w3schools.com/CSS
5. CONCLUSION

The main objective of the project is to bring a full-fledged computerized organization,


and to enable the complaint details to maintain records, which makes of peoples easier. Thus,
the proposed system has been developed with good amount of flexibility without compromising
on the response time. Computerization of the entire system will enhance more accuracy and
reduces major part of clerical works. Fast, clear and legible reports can be generated without any
ambiguity. Integrated database design and ease of maintenance is a major advantage of the
system. User friendliness is a unique feather of the system. Hence by developing a system that is
user-friendly in nature, many users are able to work on the system with little of computer
knowledge and training.
FUTURE SCOPE OF THIS PROJECT

The “BUS ROOT AND TIMING DISPLAY SYSTEM “has been developed to satisfy all
proposed requirements. The process used to send the social complaint to the government officer
and this project more simple and easy. The system is highly scalable and user friendly. Almost
all the system objectives have been met. The system has been tested under all criteria. The
system minimizes the problem arising in the existing manual system and it eliminates the human
errors to zero level. The design of the database is flexible ensuring that the system can be
implemented. It is implemented and gone through all validation.
All phases of development were conceived using methodologies. User with little training
can get the required report. The software executes successfully by fulfilling the objectives of the
project. Further extensions to this system can be made required with minor modifications.

We designed the project in asp.net and publish the project in the online for future.

Source code:

Imports System.Data.SqlClient
Imports System.IO
Public Class complaint
Dim con As New SqlConnection("Data Source=TMINDZ-17\SQLEXPRESS;Initial
Catalog=clean;User ID=sa; pwd=sql;")
Dim com As New SqlCommand
Dim adp As New SqlDataAdapter
Dim ds As DataSet
Dim qry, str As String
Dim i As Integer
Dim j As Integer
Dim fn As String
Dim p As String
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
On Error GoTo fix
'Display Picture File
OpenFileDialog1.ShowDialog()
PictureBox1.Image = Image.FromFile(OpenFileDialog1.FileName)
fix:
Exit Sub
End Sub

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


Handles Button2.Click
Dim fs As FileStream = New FileStream(OpenFileDialog1.FileName, FileMode.Open,
FileAccess.Read)

'Read the output in binary reader


Dim r As BinaryReader = New BinaryReader(fs)
'Declare a byte array to save the content of the file to be saved
Dim FileByteArray(fs.Length - 1) As Byte
r.Read(FileByteArray, 0, CInt(fs.Length))

Dim sql As String = "INSERT INTO


complaint(cmpid,subject,date,uid,uname,photo,cto,addr,area) VALUES
(@cmpid,@subject,@date,@uid,@uname,@photo,@cto,@addr,@area)"
'Declare a sqlCommand Object
Dim cmd As New SqlCommand(sql, con)
'Add Parameter

cmd.Parameters.Add("@cmpid", System.Data.SqlDbType.VarChar, 50).Value =


TextBox1.Text
cmd.Parameters.Add("@subject", System.Data.SqlDbType.VarChar, 500).Value =
TextBox2.Text
cmd.Parameters.Add("@date", System.Data.SqlDbType.VarChar, 50).Value =
TextBox3.Text
cmd.Parameters.Add("@uid", System.Data.SqlDbType.VarChar, 50).Value =
TextBox4.Text
cmd.Parameters.Add("@uname", System.Data.SqlDbType.VarChar, 50).Value =
TextBox5.Text
cmd.Parameters.Add("@photo", System.Data.SqlDbType.Image).Value = FileByteArray
cmd.Parameters.Add("@cto", System.Data.SqlDbType.VarChar, 50).Value =
ComboBox1.Text
cmd.Parameters.Add("@addr", System.Data.SqlDbType.VarChar, 50).Value =
TextBox7.Text
cmd.Parameters.Add("@area", System.Data.SqlDbType.VarChar, 50).Value =
TextBox8.Text
con.Open()
cmd.ExecuteNonQuery()
MsgBox("Succesfully Sent", MessageBoxIcon.Information)
con.Close()

TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
ComboBox1.Text = "[email protected]"
TextBox7.Text = ""
TextBox8.Text = ""
PictureBox1.Image = Nothing

End Sub
Private Sub DrawToScale(ByVal img As Image)
PictureBox1.Image = New Bitmap(img)
End Sub
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button3.Click
Me.Hide()
End Sub

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


Handles MyBase.Load
TextBox3.Text = Date.Today
'Center Of Screen'
Dim boundWidth As Integer = Screen.PrimaryScreen.Bounds.Width
Dim boundHeight As Integer = Screen.PrimaryScreen.Bounds.Height
Dim x As Integer = boundWidth - Me.Width
Dim y As Integer = boundHeight - Me.Height
Me.Location = New Point(x / 2, y / 2)

PictureBox1.SizeMode = PictureBoxSizeMode.StretchImage

Try
Dim p As String
str = "select cmpid from complaint"
com = New SqlCommand(Str, con)
adp = New SqlDataAdapter(com)
ds = New DataSet
adp.Fill(ds, "complaint")
i = ds.Tables("complaint").Rows.Count
p = ds.Tables("complaint").Rows(i - 1)(0)
p = Mid(p, 4)
p = Val(p) + 1
If Len(p) = 1 Then
p = "000" + p
ElseIf Len(p) = 2 Then
p = "00" + p
ElseIf Len(p) = 3 Then
p = "0" + p
End If
TextBox1.Text = "cmp" + p

Catch ex As Exception
TextBox1.Text = "cmp0001"
End Try
ComboBox1.Text = "[email protected]"
Try

str = "select mailid from media"


com = New SqlCommand(str, con)
adp = New SqlDataAdapter(com)
ds = New DataSet
adp.Fill(ds, "media")
i = ds.Tables("media").Rows.Count
Dim j As Integer
For j = 0 To i - 1
ComboBox1.Items.Add(ds.Tables("media").Rows(j)(0))
Next
Catch ex As Exception

End Try
End Sub

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


Handles Button4.Click
Try
fn = InputBox("Enter complaint id:")

Dim sql As String = "SELECT photo FROM complaint WHERE cmpid='" & fn & "'"

con.Open()

Dim cmd As SqlCommand = New SqlCommand(sql, con)


Dim b() As Byte
b = cmd.ExecuteScalar()

If (b.Length > 0) Then


Dim stream As New MemoryStream(b, True)
stream.Write(b, 0, b.Length)
'Display image
DrawToScale(New Bitmap(stream))
stream.Close()
End If

con.Close()

Catch ex As Exception

MsgBox(" Invalid complaint Number enter Correct complaint ID")


End Try

Try
qry = "select subject,date,uid,uname,cto,addr,area from complaint where cmpid='" + fn +
"'"
com = New SqlCommand(qry, con)
adp = New SqlDataAdapter(com)
ds = New DataSet
adp.Fill(ds, "complaint")
TextBox1.Text = fn
TextBox2.Text = ds.Tables("complaint").Rows(0)(0)
TextBox3.Text = ds.Tables("complaint").Rows(0)(1)
TextBox4.Text = ds.Tables("complaint").Rows(0)(2)
TextBox5.Text = ds.Tables("complaint").Rows(0)(3)
ComboBox1.Text = ds.Tables("complaint").Rows(0)(4)
TextBox7.Text = ds.Tables("complaint").Rows(0)(5)
TextBox8.Text = ds.Tables("complaint").Rows(0)(6)

Catch ex As Exception

End Try
End Sub

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


Handles Button5.Click

Dim sql As String = "update complaint set


cmpid=@cmpid,subject=@subject,date=@date,uid=@uid,uname=@uname,cto=@cto,addr=@ad
dr,area=@area where cmpid=@cmpid"
'Declare a sqlCommand Object
Dim cmd As New SqlCommand(sql, con)
'Add Parameter

cmd.Parameters.Add("@cmpid", System.Data.SqlDbType.VarChar, 50).Value =


TextBox1.Text
cmd.Parameters.Add("@subject", System.Data.SqlDbType.VarChar, 500).Value =
TextBox2.Text
cmd.Parameters.Add("@date", System.Data.SqlDbType.VarChar, 50).Value =
TextBox3.Text
cmd.Parameters.Add("@uid", System.Data.SqlDbType.VarChar, 50).Value =
TextBox4.Text
cmd.Parameters.Add("@uname", System.Data.SqlDbType.VarChar, 50).Value =
TextBox5.Text
'cmd.Parameters.Add("@photo", System.Data.SqlDbType.Image).Value = FileByteArray
cmd.Parameters.Add("@cto", System.Data.SqlDbType.VarChar, 50).Value =
ComboBox1.Text
cmd.Parameters.Add("@addr", System.Data.SqlDbType.VarChar, 50).Value =
TextBox7.Text
cmd.Parameters.Add("@area", System.Data.SqlDbType.VarChar, 50).Value =
TextBox8.Text
con.Open()
cmd.ExecuteNonQuery()
MsgBox("Succesfully Updated", MessageBoxIcon.Information)
con.Close()

TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
ComboBox1.Text = "[email protected]"
TextBox7.Text = ""
TextBox8.Text = ""
PictureBox1.Image = Nothing

End Sub

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


Handles Button6.Click
con.Open()
str = "delete from complaint where cmpid='" & TextBox1.Text & "'"
com = New SqlCommand(str, con)
com.ExecuteNonQuery()
MsgBox("Succesfully deleted")
con.Close()
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
ComboBox1.Text = "[email protected]"
TextBox7.Text = ""
TextBox8.Text = ""
PictureBox1.Image = Nothing

End Sub
End Class

Imports System.Data.SqlClient
Imports System.IO
Public Class media
Dim con As New SqlConnection("Data Source=TMINDZ-17\SQLEXPRESS;Initial
Catalog=clean;User ID=sa; pwd=sql;")
Dim cmd As New SqlCommand
Dim str As String
Dim adp As New SqlDataAdapter
Dim ds As New DataSet
Dim i As Integer
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs)
Handles Button1.Click
If TextBox1.Text = "" Or TextBox2.Text = "" Or TextBox3.Text = "" Or TextBox4.Text =
"" Then
MsgBox("enter all data")
Else
con.Open()
str = "insert into media values( '" & TextBox1.Text & "','" & TextBox2.Text & "','" &
TextBox3.Text & "','" & TextBox4.Text & "','" & TextBox5.Text & "')"
cmd = New SqlCommand(str, con)
cmd.ExecuteNonQuery()
MsgBox("successfully saved")
End If

TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""

End Sub

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


Handles MyBase.Load
Try
Dim p As String
str = "select mediaid from media"
cmd = New SqlCommand(str, con)
adp = New SqlDataAdapter(cmd)
ds = New DataSet
adp.Fill(ds, "media")
i = ds.Tables("media").Rows.Count
p = ds.Tables("media").Rows(i - 1)(0)
p = Mid(p, 4)
p = Val(p) + 1
If Len(p) = 1 Then
p = "000" + p
ElseIf Len(p) = 2 Then
p = "00" + p
ElseIf Len(p) = 3 Then
p = "0" + p
End If
TextBox1.Text = "med" + p

Catch ex As Exception
TextBox1.Text = "med0001"
End Try
End Sub

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


Handles Button2.Click
con.Open()
str = "update media set mediaid='" & TextBox1.Text & "', mname='" & TextBox2.Text &
"', address='" & TextBox3.Text & "',phnum='" & TextBox4.Text & "',mailid='" &
TextBox5.Text & "' where mediaid='" + TextBox1.Text + "' "
cmd = New SqlCommand(str, con)
cmd.ExecuteNonQuery()
MsgBox("data updated")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""

End Sub

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


Handles Button3.Click
con.Open()
str = "delete from media where mediaid='" & TextBox1.Text & "'"
cmd = New SqlCommand(str, con)
cmd.ExecuteNonQuery()
MsgBox("successfully deleted")
TextBox1.Text = ""
TextBox2.Text = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub

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


Handles Button4.Click
Try
Dim s As String
s = InputBox("Enter Media ID:")
str = "select * from media where mediaid='" + s + "'"
cmd = New SqlCommand(str, con)
adp = New SqlDataAdapter(cmd)
ds = New DataSet
adp.Fill(ds, "media")
TextBox1.Text = s
TextBox2.Text = ds.Tables("media").Rows(0)(0)
TextBox3.Text = ds.Tables("media").Rows(0)(1)
TextBox4.Text = ds.Tables("media").Rows(0)(2)
TextBox5.Text = ds.Tables("media").Rows(0)(3)

Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

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


Handles Button5.Click
Me.Hide()
End Sub
End Class

You might also like