[go: up one dir, main page]

0% found this document useful (0 votes)
139 views42 pages

Resource Usage Information System

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)
139 views42 pages

Resource Usage Information System

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/ 42

1.

INTRODUCTION
1.1 OVERVIEW OF THE PROJECT
This project entitled as “RESOURCE USAGE INFORMATION SYSTEM”. This

is used to computerize the printer usage information and functions across a single large

organization. This application is developed in a .NET platform. The front end of this project

is Visual Basic.Net and the back end is SQL Server.

This application can search any one of the student records as user requirement very

quickly for which manual operation take more time. This application increases the work

performance than previous work efficiency. And it calculates any calculation very quickly

and provides approximately hundred percentage efficient result. The application should

evaluate the students information and resources information.

MODULES

 Authentication Module

 Admin Account

 User Account

 Student Registration Module

 Resource Usage Module

 Resource Usage Report

1
1.2 SYSTEM SPECIFICATION

1.2.1 HARDWARE SPECIFICATION

Processor : Intel Core I3 or faster

RAM : 2 GB

Hard Disk Drive : 500 GB

Clock Speed : 2 GHz

Monitor : Color Monitor

Printer : Laser Printer

Keyboard : Multi Media

Mouse : Optical Mouse

1.2.2 SOFTWARE SPECIFICATION

Technology : Windows

Front End : Visual Basic.Net 2010

Back End : SQL Server 2008

SOFTWARE DESCRIPTION

FRONT END

THE .NET FRAMEWORK

2
The Microsoft .NET Framework is a software technology that is available with

several Microsoft Windows operating systems. It includes a large library of pre-coded

solutions to common programming problems and a virtual machine that manages the

execution of programs written specifically for the framework. The .NET Framework is a key

Microsoft offering and is intended to be used by most new applications created for the

Windows platform.

Microsoft Visual Studio is an integrated development environment (IDE)

from Microsoft. It is used to develop computer programs for Microsoft Windows, as well

as web sites, web applications and web services. Visual Studio uses Microsoft software

development platforms such as Windows API, Windows Forms, Windows Presentation

Foundation, Windows Store and Microsoft Silverlight. It can produce both native

code and managed code.

Visual Studio includes a code editor supporting IntelliSense (the code

completion component) as well as code refactoring. The integrated debugger works both as a

source-level debugger and a machine-level debugger. Other built-in tools include a forms

designer for building GUI applications, web designer, class designer, and database

schema designer. It accepts plug-ins that enhance the functionality at almost every level—

including adding support for source-control systems (like Subversion) and adding new

toolsets like editors and visual designers for domain-specific languages or toolsets for other

aspects of the software development lifecycle (like the Team Foundation Server client: Team

Explorer).

Visual Studio supports different programming languages and allows the code editor

and debugger to support (to varying degrees) nearly any programming language, provided a

language-specific service exists. Built-in languages include C, C++and C++/CLI (via Visual

C++), VB.NET (via Visual Basic .NET), C# (via Visual C#), and F# (as of Visual Studio

3
2010). Support for other languages such as M, Python, and Ruby among others is available

via language services installed separately.

The pre-coded solutions that form the framework's Base Class Library cover a large

range of programming needs in a number of areas, including user interface, data access,

database connectivity, cryptography, web application development, numeric algorithms, and

network communications. The class library is used by programmers, who combine it with

their own code to produce applications.

Programs written for the .NET Framework execute in a software environment that

manages the program's runtime requirements. Also part of the .NET Framework, this runtime

environment is known as the Common Language Runtime (CLR). The CLR provides the

appearance of an application virtual machine so that programmers need not consider the

capabilities of the specific CPU that will execute the program. The CLR also provides other

important services such as security, memory management, and exception handling. The class

library and the CLR together compose the .NET Framework.

The .NET Frame work class library

It is a comprehensive, object-oriented collection of reusable types used to develop

applications ranging from traditional command-line or graphical user interface (GUI)

applications to applications based on the latest innovations provided by ASP.NET, such as

Web Forms and XML Web services.

The .NET Framework can be hosted by unmanaged components that load the

common language runtime into their processes and initiate the execution of managed code,

thereby creating a software environment that can exploit both managed and unmanaged

features. The .NET Framework not only provides several runtime hosts, but also supports the

development of third-party runtime hosts.

4
Internet Explorer is an example of an unmanaged application that hosts the runtime

(in the form of a MIME type extension). Using Internet Explorer to host the runtime to

enables embeds managed components or Windows Forms controls in HTML documents.

ASSEMBLIES

An assembly is a collection of types and resources that forms a logical unit of

functionality. All types in the .NET Framework must exist in assemblies; the common

language runtime does not support types outside of assemblies. Each time you create a

Microsoft Windows Application, Windows Service, Class Library, or other application with

Visual Basic .NET, you're building a single assembly. Each assembly is stored as an .exe

or .dll file.

The name of an assembly consists of four parts.

1. The short name. On Windows this is the name of the Portable Executable (PE) file

without the extension.

2. The culture. This is an RFC 1766 identifier of the locale for the assembly. In general,

library and process assemblies should be culture neutral; the culture should only be

used for satellite assemblies.

3. The version. This is a dotted number made up of four values — major, minor, build

and revision.

4. A public key token. This is a 64-bit hash of the public key that corresponds to the

private key used to sign[1] the assembly. A signed assembly is said to have a strong

name.

COMMON TYPE SYSTEM 

It describes set of data types that can be used in different .Net languages in common. (i.e),

CTS ensures that objects written in different .Net languages can interact with each other.

5
For Communicating between programs written in any .NET complaint language, the types

have to be compatible on the basic level.

The common type system supports two general categories of types:  

Value types:

Value types directly contain their data, and instances of value types are either allocated on the

stack or allocated inline in a structure. Value types can be built-in (implemented by the

runtime), user-defined, or enumerations.

Reference types:

Reference types store a reference to the value's memory address, and are allocated on the

heap. Reference types can be self-describing types, pointer types, or interface types. The type

of a reference type can be determined from values of self-describing types. Self-describing

types are further split into arrays and class types. The class types are user-defined classes,

boxed value types, and delegates.  

CROSS LANGUAGE INTEROPERABILITY

The common language runtime's built-in support for language interoperability and

explains the role that the Common Language Specification (CLS) plays in enabling

guaranteed cross-language interoperability. Language interoperability is the ability of code to

interact with code that is written by using a different programming language. Language

interoperability can help maximize code reuse and improve the efficiency of the development

process.

Because developers use a wide variety of tools and technologies, each of which might

support different features and types, it has historically been difficult to ensure language

6
interoperability. However, language compilers and tools that target the common language

runtime benefit from the runtime's built-in support for language interoperability.

The common language runtime provides the necessary foundation for language

interoperability by specifying and enforcing a common type system and by providing

metadata. Because all languages targeting the runtime follow the common type system rules

for defining and using types, the usage of types is consistent across

languages. Metadata enables language interoperability by defining a uniform mechanism for

storing and retrieving information about types. Compilers store type information as metadata,

and the common language runtime uses this information to provide services during execution;

the runtime can manage the execution of multi language applications because all type

information is stored and retrieved in the same way, regardless of the language the code was

written in.

Managed code benefits from the runtime's support for language interoperability in the

following ways:

 Types can inherit implementation from other types, pass objects to another type's

methods, and call methods defined on other types, regardless of the language the

types are implemented in.

 Debuggers, profilers, or other tools are required to understand only one environment

—the Microsoft intermediate language (MSIL) and metadata for the common

language runtime—and they can support any programming language that targets the

runtime.

 Exception handling is consistent across languages. Your code can throw an exception

in one language and that exception can be caught and understood by an object written

in another language.

PRINCIPAL DESIGN FEATURES

7
Interoperability 
Because interaction between new and older applications is commonly required, the

.NET Framework provides means to access functionality that is implemented in programs

that execute outside the .NET environment.

Access to COM components is provided in the System. Runtime.InteropServices and

System. Enterprise Services namespaces of the framework; access to other functionality is

provided using the P/Invoke feature.

Common Runtime Engine 

The Common Language Runtime (CLR) is the virtual machine component of the

.NET framework. All .NET programs execute under the supervision of the CLR,

guaranteeing certain properties and behaviours in the areas of memory management, security,

and exception handling.

Base Class Library 

The Base Class Library (BCL), part of the Framework Class Library (FCL), is a

library of functionality available to all languages using the .NET Framework. The BCL

provides classes which encapsulate a number of common functions, including file reading

and writing, graphic rendering, database interaction and XML document manipulation.

Simplified Deployment 

Installation of computer software must be carefully managed to ensure that it does not

interfere with previously installed software, and that it conforms to security requirements.

The .NET framework includes design features and tools that help address these requirements.

Security

8
The design is meant to address some of the vulnerabilities, such as buffer overflows,

that have been exploited by malicious software. Additionally, .NET provides a common

security model for all applications.

Portability 

The design of the .NET Framework allows it to theoretically be platform agnostic,

and thus cross-platform compatible.

That is, a program written to use the framework should run without change on any type of
system for which the framework is implemented.

Memory Management
The .NET Framework CLR frees the developer from the burden of managing memory

(allocating and freeing up when done); instead it does the memory management itself. To this

end, the memory allocated to instantiations of .NET types (objects) is done contiguously from

the managed heap, a pool of memory managed by the CLR. The .NET Garbage Collector

(GC) is a non-deterministic, compacting, mark-and-sweep garbage collector. The GC runs

only when a certain amount of memory has been used or there is enough pressure for memory

on the system. Since it is not guaranteed when the conditions to reclaim memory are reached,

the GC runs are non-deterministic.

The Just-In-Time Compiler

Your code does not stay IL for long, however. It is the PE file, containing the IL that

can be distributed and placed with the CLR running on the .NET Framework on any

operating system for which the .NET framework exists, because the IL is platform

independent. When you run the IL, however, it is compiled to native code for that platform.

Therefore, you are still running native code; you are not going back to the days of interpreted

code at all. The compilation to native code occurs via another tool of the .NET Framework:

9
the Just-In-Time (JIT) compiler. With the code compiled, it can run within the Framework

and take advantage of low level features such as memory management and security.

The compiled code is native code for the CPU on which the .NET Framework is

running, meaning that you are indeed running native code instead of interpreted code. A JIT

compiler will be available for each platform on which the .NET Framework runs, so you

should always be getting native code on any platform running the .NET Framework.

Remember, today this is just Windows, but this could change in the future.

BACKEND SQL SERVER

SQL Server adds certain features including a master data management system

branded as Master Data Services, a central management of master data entities and

hierarchies. Also Multi Server Management, a centralized console to manage multiple SQL

Server 2008 instances and services including relational databases, Reporting Services,

Analysis Services & Integration Services.

SQL Server new features and enhancements include Always On SQL Server Failover

Cluster Instances and Availability Groups which provides a set of options to improve

database availability Contained Databases which simplify the moving of databases between

instances, new and modified Dynamic Management Views and Functions, programmability

enhancements including new spatial features, metadata discovery, sequence objects and the

THROW statement, performance enhancements such as Column Store Indexes as well as

improvements to On Line and partition level operations and security enhancements including

provisioning during setup, new permissions, improved role management, and default schema

assignment for groups.

SQL Server stores records relating to each other in a table. Different tables are

created for the various groups of information. Related tables are grouped together to form a

10
database. SQL Server new features and enhancements include Always On SQL Server

Failover Cluster Instances and Availability Groups which provides a set of options to

improve database availability  A database management, or DBMS, gives the user access to

their data and helps them transform the data into information. Such database management

systems include dBase, paradox, IMS, SQL Server and SQL Server. These systems allow

users to create, update and extract information from their database. It is called as data

manipulation.

Primary Key

Every table in SQL Server has a field or a combination of fields that uniquely

identifies each record in the table. The Unique identifier is called the Primary Key, or simply

the Key. The primary key provides the means to distinguish one record from all other in a

table. It allows the user and the database system to identify, locate and refer to one particular

record in the database.

Foreign Key

When a field is one table matches the primary key of another field is referred to as a

foreign key. A foreign key is a field or a group of fields in one table whose values match

those of the primary key of another table.

2. SYSTEM STUDY

2.1 EXISTING SYSTEM

11
The resource usage information system concept for manage the entire schedule. It takes

more manual hours that need to spend in record keeping and generating reports. This

application keeps the data in a centralized way which is available to all the users

simultaneously. It is not effective to manage historical data in database. They need tool that

decreases manual hours spending for normal things and hence increases the performance.

2.1.1 DRAWBACKS OF EXISTING SYSTEM

 It is time consuming process

 The present system is very less secure

 Risk of data loss

 Fewer Users - Friendly

 Maintenance is not effectively done

 Information cannot be retrieved easily

 Data retrieval is to take more time

2.2 PROPOSED SYSTEM

12
Proposed system can using this technology we can make fast to handle resource

management about the student. Which try to automate the entire process keeping in view of

the database integration approach. These proposed system is window based application.

2.2.1 ADVANTAGES OF PROPOSED SYSTEM

 User friendliness is provided in the application with various controls

 Manage the entire process in easy and quick way

 Saves administrator time

 Easily analyse the feedback

 Reduce the data redundancy

 Data integrity is maintained

3. SYSTEM DESIGN AND DEVELOPMENT

13
3.1 FILE DESIGN
File design is the act of taking the marketing information and creating the design of

the product to be manufactured. File design is therefore the process of defining and

developing systems to satisfy specified requirements of the user. Object-oriented analysis and

design methods are becoming the most widely used methods for computer systems design. It

is widely used for modelling software systems and is increasingly used for high designing

non-software systems and organizations.

3.2 INPUT DESIGN


The input design is process of converting the external user oriented description of an

input into a machine-oriented format.

OBJECTIVES OF INPUT DESIGN

In accurate input data is the most common cause of errors in data processing. Errors

found at the data entry can be controlled by the proper input design. The input was designed

with the following objectives

 To produce a cost effective method.

 To get the highest level of accuracy.

 To ensure that the input is acceptable and understandable by the people who

are using it.

With the above objectives the major activities that were done during the input design is,

 The data are collected from its source.

 Data are converted to the computer acceptable form.

 The converted data was verified.

3.3 OUTPUT DESIGN

14
The outputs were needed to be generated as a hard copy and as well as queries to be

viewed on the screen. Keeping in view these outputs, the format for the output is taken from

the outputs, which are currently being obtained after manual processing. The standard printer

is to be used as output media for hard copies.

Outputs from computer systems are required primarily to communicate the results of

processing to users. They are also used to provide a permanent copy of the results for later

consultation. The various types of outputs in general are:

 External Outputs, whose destination is outside the organization

 Internal Outputs whose destination is within organization and they are the

 User’s main interface with the computer.

 Operational outputs whose use is purely within the computer department.

 Interface outputs, which involve the user in communicating directly

3.4 DATABASE DESIGN


The database design steps are applied to identify the various entities and relationships

between them. General access methods are then applied to the conceptual schema to get the

logical model, which is then further transformed into relational tables.

The database design refers to the data organization, in the backup storage system.

This design place and important and critical role for the successful performance.

3.5 SYSTEM DEVELOPMENT

15
3.5.1 DESCRIPTION OF MODULES

1) Authentication Module

Authentication is used to verify the administrator account. If user Id and password are

valid then the users enter into the system.

2) Student Registration Module

This module contains the details of each particular student details. This module is to

indicate the student’s details such as id, name, department and year of studying.

3) Resource Usage Module

This module used to maintain usage information about printer in college libratory, In

this module usage id is maintained as unique key to avoid redundancy.

4) Reports

Reports are generated by the administrator can generate and view the reports like

usage report, based on daily and monthly.

4. TESTING AND SYSTEM IMPLEMENTATION

16
4.1 SYSTEM TESTING

Software testing is a critical element and represents the ultimate view of specification,

design, and coding. The user tests it developed system and changes are made according their

needs. The testing phase involves it testing of developed system using various kinds of data.

System testing is actually a series of different tests whose primary purpose is to fully

exercise the computer-based system. System testing is the stage of implementation that is

aimed at assuring that the system works accurately and efficiently before live operation

commerce. Testing is the vital to the successor of the system. System testing makes it logical

assumption that if all the parts of the system are correct, the goal will be successfully

achieved. A series of testing is performed for the proposed system before the system is ready

for user acceptance test.

Unit Testing

Unit testing focused the verification effort on the smallest unit of the software design

module. This is known as module testing. The systems are better separately. The testing was

concerned out during the programming stage itself. In this testing step each module was

found to be working satisfactory with to the expected.

White-box testing

White box testing focus on the control structure of the program. Test cases are derived to

ensure that all statements in the program have been executed at least once during testing and

that all logical conditions have been executed.

 All independent paths have been exercised at least once

 All logical decisions have been exercised on their true and false sides

17
Black-box testing

Black box testing is designed to validate functional requirements without regard to the

internal workings of a program. Black box testing mainly focuses on the information domain

of the software, deriving test cases by partitioning input and output in a manner that provides

through test coverage. Incorrect and missing functions, interface errors, errors in data

structures, error in functional logic are the errors falling in this category.

 All loops are executed at their boundaries and within their operational bounds

 All internal data structures have been exercised to assure their validity

Acceptance Testing

Accepting test is performed on a collection of functions in a production and after the

completion of functional testing. This is the final stage in the testing process before the

system is accepted for operational use. This testing is should be done with original data and

with the presence of the users. This test confirms the system ready for use.

Integration Testing

Data can be lost across an interface, one module can have an adverse effect on

another, sub function when combined, may not produce the desired major function.

Integration testing is a systematic technique for constructing the program. Structure, which at

the same time conducting tests to uncover errors associated with in the interface. The

objective is to take unit tested module s and to build a program structure. All the modules are

combined and tested a whole.

Here correction is difficult because the isolated of causes is complicated by the vast

expanse of the entire program. Thus is the integration-testing step, all the errors uncovered

for the next testing steps.

18
Validation Testing

At the culmination of integration testing, software is completely assembled as a

package, interfacing errors have been uncovered and corrected and a final series of software

upon which validation tests begin. Validation testing can be defined in many was but a simple

definition id that validation succeeds when the software function is a manner that can be

relationally expected by the client.

After validation test has been conducted one of the two possible condition exits the

function or performance characteristics conform to specification and are expected. A

deviation from specification is uncovered and a deficiency list is created.

4.2 SYSTEM IMPLEMENTATION

The implementation of a computer based system requires to be tested first so that one

can firm whether it work effectively. It is also tested on the basis of its performable and

effectiveness. The tested should be carried out is a well planned and it is structured manner to

see whether there are only loop holes and there loop holes must be effectively removed.

System Security

The developed system will be executed only by giving the password. The password

facility gives security to the system such that no unauthorized person can enter the system

and edit and also someone else cannot copy the software.

There Are Three Motives Behind Security:

 The near total dependence of organization on computer based information makes it

imperative that a system be produced on a regular basis.

19
 Data are a major asset and should be produced in a database environment where

computer files are centralized, Security becomes critical.

 Demonstrating effective security measures reinforces management’s support for

designing and implementing desktop shield system.

20
5. CONCLUSION AND FUTURE ENHANCEMENT

5.1 CONCLUSION

The generation of “RESOURCE USAGE INFORMATION SYSTEM” is

computerized and quick easier then when done manually. Appropriate messages are

displayed to assist to user whenever necessary. Input screens are simple and easy to

understand. This project is consistent and useful one.

This application has been developed to meet almost all the requirements of the user.

The system is tested with the sample data and found to be executing at its maximum

performance. The software enables the organization to carry out the feedback and preparing

the report effectively after the implementation. When all the suggestions forwarded in the

software proposal have been successfully completed.

5.2 FUTURE ENHANCEMENT

This project has been developed keeping in mind all the given possible conditions to

overcome the disadvantages of existing system. The system is implemented successfully.

After implementation of the system the client may require some changes to be made with the

project. This project was enhanced as the web application. Whenever changes are made it

will not affect the performance or efficiency of the existing system. Several navigations can

be provided for easy access of data.

The alterations will be saved and it can be used along with the existing system. The

changes requested by the user after implementation of the project can be done easily and

added to the existing system. The student feedback can be accessed by various departments.

The admin can view the feedback details from anywhere if this project is enhanced as the

web application.

21
6. BIBLIOGRAPHY

TEXT BOOKS

1. Roger S. Pressman, “Software Engineering: A Practioner’s Approach”, McGraw-Hill

International Edition, Fifth edition, 2001.

2. Designing Microsoft “VB.NET Applications”, TataMcGrawHill Edtion, 2001.

3. Benjamin Nevarez, “Inside the SQL Server Query Optimize”, Red gate books , 2011

4. Damon Allison, Andy Olsen, and James Speer, “Visual Basic .NET Class Design

Handbook: Coding Effective Classes” Sep 5, 2003.

5. Elias M.Award, “System Analysis and Design”, Galgotia Publications, Second Edition.

WEBSITES

1. www.infinitysql.com

2. www.elsevisedefault.vb.com

3. www. dotnet-tricks.com

4. www. sqlmag.com

5. www.vbtutor.net

22
APPENDIX
A.DATA FLOW DIAGRAM

Level 0

Admin
Id,pwd Login View Resource Usage
Information

Level 1

Student New Register Account Login

Access

Entry

Resource
Usage

Generate

Report

23
B. ER DIAGRAM Gender

Student Password Date of Birth

Student Name Contact Number


User Name
Password Student RNo Mail ID

Admin Login / Student Details Student Type


Manage
Student Login

Address

Resource Usage ID Studying Course

Update Number of Pages

Student Name

Student RNo

Purpose

Resource Usage Use

Date

Time

Usage Notes

C.TABLE DESIGN
24
1) Table Name: Login Details

Primary Key: STRno

Field Name Data Type Size Description


STRno nvarchar 6 Student registration number
Stpwd nvarchar 20 Student Password

2) Table Name: Student Details

Primary Key: STRno

Field Name Data Type Size Description

25
STRno nvarchar 6 Student registration number
Stname nvarchar 25 Student name
Stpwd nvarchar 20 Student Password
Stgend nvarchar 6 Student gender
Stdob date - Student date of birth
Stcno int 10 Student contact number
Stmail nvarchar 20 Student mail id
Stadd nvarchar 50 Student address
Crsstd nvarchar 20 Course Studying
Stdtype nvarchar 20 Student Type

3) Table Name: Resource Usage Details

Primary Key: RUID

Field Name Data Type Size Description


RUID int 3 Resource Usage ID
STRno nvarchar 6 Student Registration number
Stname nvarchar 25 Student name
RUdate date - Resource Usage Date
RUtime time - Resource Usage Time
NPNo int 5 Number of Pages
UPur nvarchar 10 Usage Purpose
UNotes nvarchar MAX Usage Notes

26
D. SAMPLE SCREENS

27
Fig 1: User Selection Form

28
Fig 2: Admin Invalid Login Form

29
Fig 3: Admin Valid Login Form

30
Fig 4: Admin Menu Form

31
Fig 5: Student Registration Form

32
Fig 6: User Login Form

33
Fig 7: User Selection Form

34
Fig 8: Resource Usage Form

35
Fig 9: Date Wise Resource Usage Form

36
Fig 10: Resource Usage Report

E. SAMPLE CODING
Imports System.Data
Imports System.Data.SqlClient
Public Class StudentRegistration

37
Dim con As New SqlConnection
Dim cmd As New SqlCommand
Dim da As New SqlDataAdapter("select *from Students", con)
Dim ds As New DataSet
Dim dbind As New BindingSource
Dim a As Integer = 0
Dim qry, qry1 As String
Dim i As Integer
Dim reader As SqlDataReader
Dim adp As SqlDataAdapter
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
Me.Hide()
End Sub

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


Handles MyBase.Load
LoadDatabase()
Load1()

End Sub
Private Sub LoadDatabase()
con.Close()
con.ConnectionString = "Data Source=.\SQLEXPRESS;Initial
Catalog=Resources;Integrated Security=True"
con.Open()
End Sub
Public Sub Load1()
ClearGridView()
LoadDatabase()
da.Fill(ds, "Students")
dbind.DataSource = ds
dbind.DataMember = ds.Tables(0).ToString()
DataGridView1.DataSource = dbind
End Sub
Private Sub ClearGridView()
For Each row As DataGridViewRow In DataGridView1.Rows
DataGridView1.Rows.Remove(row)
Next
End Sub
Public Sub clear()

txtbuyerid.Clear()
TextBox1.Clear()
TextBox4.Clear()
txtaddress.Clear()
txtcontact.Clear()
txtmail.Clear()

End Sub

38
Private Sub DataGridView1_SelectionChanged(ByVal sender As Object, ByVal e As
System.EventArgs) Handles DataGridView1.SelectionChanged
Try
Dim dgv As DataGridView = TryCast(sender, DataGridView)
If dgv IsNot Nothing AndAlso dgv.SelectedRows.Count > 0 Then
Dim row As DataGridViewRow = dgv.SelectedRows(0)
If row IsNot Nothing Then
txtbuyerid.Text = row.Cells(0).Value.ToString()
TextBox1.Text = row.Cells(1).Value.ToString()
TextBox4.Text = row.Cells(2).Value.ToString()
ComboBox1.Text = row.Cells(3).Value.ToString()
txtcontact.Text = row.Cells(5).Value.ToString()
txtmail.Text = row.Cells(6).Value.ToString()
txtaddress.Text = row.Cells(7).Value.ToString()
ComboBox2.Text = row.Cells(8).Value.ToString()
ComboBox3.Text = row.Cells(9).Value.ToString()
dtdate.Value = row.Cells(4).Value.ToString()
End If
End If
Catch ex As Exception
End Try
End Sub

Private Sub btInsert_Click(sender As System.Object, e As System.EventArgs) Handles


btInsert.Click
LoadDatabase()
cmd.Parameters.Clear()
Try
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "spInsertStudent"
cmd.Parameters.AddWithValue("@RNo", txtbuyerid.Text)
cmd.Parameters.AddWithValue("@PWD", TextBox1.Text)
cmd.Parameters.AddWithValue("@SName", TextBox4.Text)
cmd.Parameters.AddWithValue("@GND", ComboBox1.Text)
cmd.Parameters.AddWithValue("@DOB", dtdate.Value)
cmd.Parameters.AddWithValue("@PHNo", txtcontact.Text)
cmd.Parameters.AddWithValue("@EID", txtmail.Text)
cmd.Parameters.AddWithValue("@Addr", txtaddress.Text)
cmd.Parameters.AddWithValue("@CR", ComboBox2.Text)
cmd.Parameters.AddWithValue("@TP", ComboBox3.Text)

cmd.ExecuteNonQuery()
MsgBox("Details of Student are Successfully Inserted", vbInformation, "Successfully
Inserted")
clear()
con.Close()
Catch ex As Exception
MsgBox("Details are not Inserted! Please Try Later", vbInformation, "Error In
Inserting Company Details")

39
End Try
ClearGridView()
ClearGridView()
ClearGridView()
ClearGridView()
ClearGridView()
ClearGridView()
ClearGridView()

Load1()
End Sub

Private Sub btUpdate_Click(sender As System.Object, e As System.EventArgs) Handles


btUpdate.Click
LoadDatabase()
Me.Refresh()
'Dim answer As Long
Try
cmd.Parameters.Clear()
'answer = MsgBox("Are you sure to Updating Data?", vbYesNo, "Updating Record")
'If (answer = vbYes) Then
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "spUpdateStudent"
'cmd.Parameters.Add("@ProductCode", SqlDbType.NVarChar).Value =
ttProductCode.Text
cmd.Parameters.AddWithValue("@PWD", TextBox1.Text)
cmd.Parameters.AddWithValue("@SName", TextBox4.Text)
cmd.Parameters.AddWithValue("@GND", ComboBox1.Text)
cmd.Parameters.AddWithValue("@DOB", dtdate.Value)
cmd.Parameters.AddWithValue("@PHNo", txtcontact.Text)
cmd.Parameters.AddWithValue("@EID", txtmail.Text)
cmd.Parameters.AddWithValue("@Addr", txtaddress.Text)
cmd.Parameters.AddWithValue("@CR", ComboBox2.Text)
cmd.Parameters.AddWithValue("@TP", ComboBox3.Text)
cmd.Parameters.Add("@RNo", SqlDbType.NVarChar).Value = txtbuyerid.Text
cmd.ExecuteNonQuery()
MsgBox("Student Details Updated", vbInformation, "Succesfully Updated")
clear()
con.Close()
ClearGridView()
ClearGridView()
ClearGridView()
ClearGridView()
ClearGridView()
ClearGridView()
Load1()
Me.Refresh()
'Else
'txtSerialNo.Focus()

40
''End If
Catch ex As Exception
MsgBox("Unable to Update Record! Please Try Later", vbInformation, "Error in
Updating Record")
End Try
End Sub

Private Sub btDelete_Click(sender As System.Object, e As System.EventArgs) Handles


btDelete.Click
LoadDatabase()
Me.Refresh()
' Dim answer As Long
Try
cmd.Parameters.Clear()
'answer = MsgBox("Are you sure to Deleting Data?", vbYesNo, "Delete Record")
'If (answer = vbYes) Then
cmd.Connection = con
cmd.CommandType = CommandType.StoredProcedure
cmd.CommandText = "spDeleteStudent"
cmd.Parameters.Add("@RNo", SqlDbType.NVarChar).Value = txtbuyerid.Text
'cmd.Parameters.AddWithValue("@ProductCode", ttProductCode.Text)
cmd.ExecuteNonQuery()
MsgBox("Details Deleted", vbInformation, "Successfully Deleted")
clear()
ClearGridView()
ClearGridView()
ClearGridView()
ClearGridView()
ClearGridView()
ClearGridView()
Load1()
Me.Refresh()
'Else
' txtSerialNo.Focus()
'End If
Catch ex As Exception
MsgBox("Unable to Delete Record! Please Try Later", vbInformation, "Error in
Deleting")
End Try
End Sub

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


Handles txtBSearch.TextChanged
Dim con As New SqlConnection
con = New SqlConnection()
con.ConnectionString = "Data Source=.\SQLEXPRESS;Initial
Catalog=Resources;Integrated Security=True"
con.Open()
Dim da As New SqlDataAdapter("spSearchStudent", con)
da.SelectCommand.Parameters.Clear()

41
da.SelectCommand.CommandType = CommandType.StoredProcedure
da.SelectCommand.Parameters.AddWithValue("SName", TextBox4.Text)
Dim dt As New DataTable
da.Fill(dt)
DataGridView1.DataSource = dt
con.Close()
End Sub

Private Sub btClear_Click(sender As System.Object, e As System.EventArgs) Handles


btClear.Click
txtbuyerid.Clear()
TextBox1.Clear()
TextBox4.Clear()
txtaddress.Clear()
txtcontact.Clear()
txtmail.Clear()

End Sub
End Class

42

You might also like