- Version
- Download 720
- File Size 50.71 KB
- File Count 1
- Create Date April 26, 2016
- Last Updated April 26, 2016
Library Book Catalog System in Visual Basic
Library Book Catalog System in Visual Basic
Book Catalog System is just like OPAC or Online Public Access Catalog. This application is a network based in which it can be view and use via your LAN or local access network, it can also be installed on multiple computers and access it simultaneously. It is actually incorporated in the main system which is the Library System and the records or database resides in the server in which the Library System is installed. The purpose of this application is to make the searching of books much easier and much faster. This will be a great help not only for the administrators of the library but also to the students and other users of the library.
Source code:
Sub AdvanceSearch(lstBooks As ListView, SearchField As String, SearchKey As String, SearchSection As String, SearchCondition As String, OrderField As String, OrderType As String)
Dim lstItem As ListItem, a As Integer
If rs.State = adStateOpen Then rs.Close
If SearchCondition = "Match Case" Then
sql = " SELECT BooksInfo.BookID, BooksInfo.ISBN, BooksInfo.Title, BooksInfo.Author, BooksInfo.Category, BooksInfo.Publisher, BooksInfo.Date_Acquired, Sum(BooksInfo.NoOfCopies) AS SumOfNoOfCopies, BooksInfo.bSection" & _
" FROM BooksInfo" & _
" Where " & SearchField & " like '%%%" & SearchKey & "%%%' and BooksInfo.bSection= '" & SearchSection & "'" & _
" GROUP BY BooksInfo.BookID, BooksInfo.ISBN, BooksInfo.Title, BooksInfo.Author, BooksInfo.Category, BooksInfo.Publisher, BooksInfo.Date_Acquired,BooksInfo.bSection" & _
" Order by " & OrderField & IIf(OrderType = "Ascending", " ASC", " DESC")
ElseIf SearchCondition = "Exact Phrase" Then
sql = " SELECT BooksInfo.BookID, BooksInfo.ISBN, BooksInfo.Title, BooksInfo.Author, BooksInfo.Category, BooksInfo.Publisher, BooksInfo.Date_Acquired, Sum(BooksInfo.NoOfCopies) AS SumOfNoOfCopies, BooksInfo.bSection" & _
" FROM BooksInfo" & _
" Where " & SearchField & " = '" & SearchKey & "' and BooksInfo.bSection= '" & SearchSection & "'" & _
" GROUP BY BooksInfo.BookID, BooksInfo.ISBN, BooksInfo.Title, BooksInfo.Author, BooksInfo.Category, BooksInfo.Publisher, BooksInfo.Date_Acquired,BooksInfo.bSection" & _
" Order by " & OrderField & IIf(OrderType = "Ascending", " ASC", " DESC")
ElseIf SearchCondition = "Words Begin With" Then
sql = " SELECT BooksInfo.BookID, BooksInfo.ISBN, BooksInfo.Title, BooksInfo.Author, BooksInfo.Category, BooksInfo.Publisher, BooksInfo.Date_Acquired, Sum(BooksInfo.NoOfCopies) AS SumOfNoOfCopies, BooksInfo.bSection" & _
" FROM BooksInfo" & _
" Where " & SearchField & " like '" & SearchKey & "%%%' and BooksInfo.bSection= '" & SearchSection & "'" & _
" GROUP BY BooksInfo.BookID, BooksInfo.ISBN, BooksInfo.Title, BooksInfo.Author, BooksInfo.Category, BooksInfo.Publisher, BooksInfo.Date_Acquired,BooksInfo.bSection" & _
" Order by " & OrderField & IIf(OrderType = "Ascending", " ASC", " DESC")
End If
rs.Open sql, conn
lstBooks.ListItems.Clear
Do While Not rs.EOF
a = a + 1
Set lstItem = lstBooks.ListItems.Add(, , a, 1, 1)
lstItem.SubItems(1) = rs(0).Value
lstItem.SubItems(2) = rs(1).Value
lstItem.SubItems(3) = rs(2).Value
lstItem.SubItems(4) = rs(3).Value
lstItem.SubItems(5) = rs(4).Value
lstItem.SubItems(6) = rs(5).Value
lstItem.SubItems(7) = rs(6).Value
If IsNull(rs(7).Value) Then
lstItem.SubItems(8) = 0
Else
lstItem.SubItems(8) = Val(rs(7).Value) - Val(clsBooks.BooksTotalOut(rs(0).Value))
End If
If lstItem.SubItems(8) = 0 Then
lstItem.SubItems(9) = "Not Available "
Else
lstItem.SubItems(9) = "Available"
End If
lstItem.SubItems(10) = Val(clsBooks.BooksTotalOut(rs(0).Value))
lstItem.SubItems(11) = Val(lstItem.SubItems(8)) + Val(lstItem.SubItems(10))
lstItem.SubItems(12) = rs(8).Value
rs.MoveNext
Loop
If lstBooks.ListItems.Count = 0 Then MsgBox "No data found", vbInformation, ""
'" GROUP BY BooksInfo.BookID, BooksInfo.ISBN, BooksInfo.Title, BooksInfo.Author, BooksInfo.Category, BooksInfo.Publisher, BooksInfo.Date_Acquired,BooksInfo.bSection" & _
'and BooksInfo.bSection= " & SearchSection & "
End Sub