0% found this document useful (0 votes)
71 views21 pages

Library Management VB Project Report

This document contains code for a library management system with forms for login, book information, book issue, and book return. The login form authenticates users by checking their username and password. The MDI form acts as the main window and contains menu options to open the different forms. The book information form allows inserting, updating, searching, and deleting book records from a database. The book issue form inserts issue records to another database. The book return form retrieves issue records, calculates fine based on return date, and inserts return records including calculated fine to a third database.

Uploaded by

kapil
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
71 views21 pages

Library Management VB Project Report

This document contains code for a library management system with forms for login, book information, book issue, and book return. The login form authenticates users by checking their username and password. The MDI form acts as the main window and contains menu options to open the different forms. The book information form allows inserting, updating, searching, and deleting book records from a database. The book issue form inserts issue records to another database. The book return form retrieves issue records, calculates fine based on return date, and inserts return records including calculated fine to a third database.

Uploaded by

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

TABLE DESIGN

LOGIN FORM
Public Class Form5

Private Sub Button1_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
If TextBox1.Text = "RUCHIKA" And
TextBox2.Text = "789" Then
WELCOME.Show()
Me.Hide()
Else
MsgBox("WRONG USER NAME OR
PASSWORD")

End If
End Sub

Private Sub
TextBox1_TextChanged(ByVal sender As
System.Object, ByVal e As
System.EventArgs) Handles
TextBox1.TextChanged

End Sub

Private Sub Form5_Load(ByVal sender


As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load

End Sub
End Class
MDI FORM
Imports System.Windows.Forms

Public Class MDIParent1

Private Sub
InformationToolStripMenuItem_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
InformationToolStripMenuItem.Click
Form1.Show()
End Sub
Private Sub
IssueToolStripMenuItem_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
IssueToolStripMenuItem.Click
Form2.Show()

End Sub
Private Sub
ReturnToolStripMenuItem_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
ReturnToolStripMenuItem.Click
Form3.Show()
End Sub
Private Sub MDIParent1_Load(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
End Sub
End Class
BOOK INFORMATION FORM
Imports System.Data.OleDb
Public Class Form1
Dim con As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\abc1\abc1\pplibraty\
book_info.mdb"
Dim ds As New DataSet
Dim da As New OleDbDataAdapter
Private Sub Button2_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles savebtn2.Click

Try

Dim qry As String


qry = ("insert into RK
values (" & BIDTXT.Text & ",'" &
BNAMETXT.Text & "','" & CLASSTXT.Text &
"','" & ATXT.Text & "')")
da = New
OleDbDataAdapter(qry, con)
da.Fill(ds)
ds.Clear()
qry = ("insert into issu
(book_id) values (" & BIDTXT.Text & ")")
da = New
OleDbDataAdapter(qry, con)
da.Fill(ds)
MsgBox("data saved")
BIDTXT.Clear()
BNAMETXT.Clear()
CLASSTXT.Text = ""
ATXT.Clear()

Catch ex As Exception

MsgBox(ex.Message)

End Try
End Sub
Private Sub updatebtn_Click(ByVal
sender As System.Object, ByVal e As
System.EventArgs) Handles
updatebtn.Click
Try
ds.Clear()
Dim QRY As String
QRY = "update RK SET
BOOK_NAME='" & BNAMETXT.Text & "',class
='" & CLASSTXT.Text & "',author = '" &
ATXT.Text & "' WHERE BOOK_ID=" &
BIDTXT.Text
da = New
OleDbDataAdapter(QRY, con)
da.Fill(ds)
MsgBox("RECORD UPDATED")
updatebtn.Enabled = False
0:

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

Private Sub SEARCH_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
SEARCHbtn.Click
Try
ds.Clear()
Dim ID As Integer
ID = Val(InputBox(" ENTER
BOOKID"))
Dim QRY As String
QRY = "SELECT * FROM RK
WHERE BOOK_ID=" & ID
da = New
OleDbDataAdapter(QRY, con)
da.Fill(ds)

If ds.Tables(0).Rows.Count >
0 Then
BIDTXT.Text =
ds.Tables(0).Rows(0)(0)
BNAMETXT.Text =
ds.Tables(0).Rows(0)(1)
CLASSTXT.Text =
ds.Tables(0).Rows(0)(2)
ATXT.Text =
ds.Tables(0).Rows(0)(3)
updatebtn.Enabled = True
deletebtn3.Enabled =
True

Else
MsgBox("record not
search")
End If

Catch ex As Exception

MsgBox(ex.Message)

End Try
End Sub

Private Sub Button3_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
deletebtn3.Click
Try
ds.Clear()
Dim qry As String
qry = "delete from rk where
book_id=" & BIDTXT.Text
da = New
OleDbDataAdapter(qry, con)
da.Fill(ds)
MsgBox("recorded delet")
deletebtn3.Enabled = False

Catch ex As Exception
MsgBox(ex.Message)

End Try
BIDTXT.Clear()
BNAMETXT.Clear()
CLASSTXT.Text = ""
ATXT.Clear()

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

End Sub

Private Sub GroupBox1_Enter(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
GroupBox1.Enter

End Sub
End Class
BOOK ISSUE
Imports System.Data.OleDb

Public Class Form2


Dim con As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\abc1\abc1\book iss.mdb"
Dim da As New OleDbDataAdapter
Dim ds As New DataSet
Dim cm As New OleDbCommand
Dim cn As New OleDbConnection

Private Sub Button1_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles Button1.Click
cn.Open()
Dim QRY As String
QRY = "update ISSU set stuid="
& stuid.Text & ",DATE_ISSUE=#" &
dtp1.Value.Date & "# where book_id=" &
BOOK.Text
MsgBox(QRY)

cm = New OleDbCommand(QRY, cn)


cm.ExecuteNonQuery()

MsgBox("record inserted")
cn.Close()
End Sub

Private Sub BOOK_TextChanged(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
BOOK.TextChanged

End Sub

Private Sub Form2_Load(ByVal sender


As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
cn = New
OleDbConnection("Provider=Microsoft.Jet.
OLEDB.4.0;Data Source=D:\abc1\abc1\
pplibraty\book_info.mdb")
End Sub

Private Sub GroupBox1_Enter(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
GroupBox1.Enter

End Sub

Private Sub Label4_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles Label4.Click

End Sub
End Class
BOOK RETURN
Imports system.data.oledb

Public Class Form3


Dim con As String =
"Provider=Microsoft.Jet.OLEDB.4.0;Data
Source=D:\abc1\abc1\pplibraty\
book_info.mdb"
Dim ds As New DataSet
Dim da As New OleDbDataAdapter
Dim cn As New OleDbConnection
Dim cm As New OleDbCommand

Private Sub Button1_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs)

Try
Dim qry As String

qry = "insert into return


values(" & stu_id.Text & "," & b_id.Text
& ",#" & dtp1.Value.Date & "#,#" &
dtp2.Value.Date & "#," & dtxt.Text & ","
& ftxt.Text & ")"

da = New
OleDbDataAdapter(qry, con)
da.Fill(ds)
MsgBox("recored Inserted")

Catch ex As Exception

MsgBox(ex.Message)

End Try
End Sub

Private Sub Form3_Load(ByVal sender


As System.Object, ByVal e As
System.EventArgs) Handles MyBase.Load
cn = New
OleDbConnection("Provider=Microsoft.Jet.
OLEDB.4.0;Data Source=D:\abc1\abc1\
pplibraty\RETURN.mdb")
End Sub

Private Sub Button2_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles Button2.Click
Try
ds.Clear()
Dim ID As Integer
ID = Val(InputBox("ENTER
book id"))
Dim QRY As String
QRY = "SELECT * FROM issu
WHERE book_id=" & ID & ""
da = New
OleDbDataAdapter(QRY, con)
da.Fill(ds)

If ds.Tables(0).Rows.Count >
0 Then
stu_id.Text =
ds.Tables(0).Rows(0)(0)
b_id.Text =
ds.Tables(0).Rows(0)(1)
dtp1.Value =
ds.Tables(0).Rows(0)(2)

Else
MsgBox("record not
search")
End If
Catch ex As Exception

MsgBox(ex.Message)

End Try
End Sub

Private Sub Button3_Click(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles Button3.Click
cn.Open()
Dim qry As String
qry = ("insert into return
values (" & stu_id.Text & "," &
b_id.Text & ",#" & dtp1.Value & "#,#" &
dtp2.Value & "#," & dtxt.Text & "," &
ftxt.Text & ")")
cm = New OleDbCommand(qry, cn)
cm.ExecuteNonQuery()
ds.Clear()
MsgBox("data saved")
stu_id.Clear()
b_id.Clear()
dtp1.Value = Now.Date
dtp2.Value = Now.Date
dtxt.Text = ""
ftxt.Text = ""
cn.Close()
End Sub

Private Sub dtp1_ValueChanged(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
dtp1.ValueChanged
Try

Dim d As TimeSpan
Dim d1 As Date
Dim i As Integer
d =
Date.Today.Subtract(dtp2.Value.Date)
i = -1 * d.Days

d1 =
dtp1.Value.Date.AddDays(7)
dtp2.Value = d1
dtxt.Text = i
ftxt.Text = Val(dtxt.Text) *
1
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub

Private Sub GroupBox1_Enter(ByVal


sender As System.Object, ByVal e As
System.EventArgs) Handles
GroupBox1.Enter

End Sub
End Class

You might also like