You are on page 1of 34

LIBRARY MANAGEMENT

In a traditional sense, a library is a large collection of books, and can refer to the place in which the collection is housed. Today, the term can refer to any collection, including digital sources, resources, and services. The collections can be of print, audio, and visual materials in numerous formats, including maps, prints, documents, microform (microfilm/microfiche), CDs, cassettes, videotapes, DVDs, video games, e-books, audiobooks and many other electronic resources A library is organized for use and maintained by a public body, an institution, or a private individual. Public and institutional collections and services may be intended for use by people who choose not to or cannot afford to purchase an extensive collection themselves, who need material no individual can reasonably be expected to have, or who require professional assistance with their research. In addition to providing materials, libraries also provide the services of librarians who are experts at finding and organizing information and at interpreting information needs. Libraries often provide a place of silence for studying. Libraries often provide public facilities to access to their electronic resources and the Internet. Modern libraries are increasingly being redefined as places to get unrestricted access to information in many formats and from many sources. They are extending services beyond the physical walls of a building, by providing material accessible by electronic means, and by providing the assistance of librarians in navigating and analyzing tremendous amounts of information with a variety of digital tools.

MADE BY:- ABHISHEK KHANNA CLASS:- XII-A2

CERTIFICATION
Name: ABHISHEK KHANNA Class: XII-A2 School: Delhi Public School,Ghaziabad Year: 2011-2012 Certified to be the bonafide work done by ABHISHEK KHANNA of class XII A2 in the Computer LAB during the year 2011-2012 .

Submitted for ALL INDIA SENIOR SCHOOL CERTIFICATE PRACTICAL Examination held in Computer LAB at DELHI PUBLIC SCHOOL Examiner Date__________________ Seal I would like to express my sincere gratitude to my INFORMATICS mentor Mr Mohit Saras, for his vital support, guidance and encouragement -without which this project would not have come forth.

ACKNOWLEDGEMENT
I would like to express my special thanks of gratitude to my teacher Mr.Mohit Saras as well as our principal Mrs Jyoti Gupta who gave me this golden opportunity to do this wonderful project on the Topic LIBRARY MANAGEMENT.

NET BEANS FORMS


HOME.java. USERID.java TITLE.java BOOKS.java (add a record) DELETE.java (delete a record) BDISPLAY.java (show a record) UPDATE.java (update a record) MEMBERS.java (add a record) ENTER.java (delete a record) TREE.java (update a record) MDISPLAY.java (show a record)

MY SQL TABLES
FOR BOOKS:-

FOR MEMBERS:-

MY SQL RECORDS
FOR BOOKS-:

FOR MEMBERS:-

CODING:this.setVisible(false); new userid().setVisible(true);

CODING:String name=text1.getText(); String pass=text2.getText(); if(name.equals"abc") && pass.equals("xyz")) { JOptionPane.showMessageDialog(this,"Login successful" ); this.setVisible(false); new title().setVisible(true); } else { JOptionPane.showMessageDialog(this,"Login fail" ); text1.setText(""); text2.setText(""); }

CLEAR:text1.setText(""); text2.setText("");

EXIT:System.exit(0);

TITLE

ADD A RECORD(BOOKS)

CODING:ADD:import java.sql.*; import javax.swing.JOptionPane; try { Class.forName("java.sql.DriverManager"); Connection con = (Connection) DriverManager.getConnection ("jdbc:mysql://localhost:3306/lib","root", "abc");

Statement stmt = null; stmt = con.createStatement(); String s1 = text1.getText(); String s2 = text2.getText();

String s3 = text3.getText(); String s4 = text4.getText(); String s5 = text5.getText();

String query = "INSERT INTO BOOK VALUES ( '" + s1 + "' , '" + s2 + "' , '" + s3 + "','"+s4+"','"+s5+"' );" ; int rowsins = stmt.executeUpdate(query);

if ( rowsins == 1) JOptionPane.showMessageDialog (this,"Record added successfully into the Item Table"); else JOptionPane.showMessageDialog (this,"Error during Record addition into the Item Table"); stmt.close(); con.close();

} catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); e.printStackTrace(); }

CLEAR:text1.setText(""); text2.setText(""); text3.setText(""); text4.setText(""); text5.setText("");

EXIT:SYstem.exit(0);

DATA VALIDATION:-

char ch=evt.getKeyChar(); if((ch>='a'&& ch<='z')||(ch>='A'&& ch<='Z')) { JOptionPane.showMessageDialog(this,"can't enter any character" ); evt.consume(); }

char ch=evt.getKeyChar(); if((ch>='0'&& ch<='9')) { JOptionPane.showMessageDialog(this,"can't enter any Number" ); evt.consume(); }

HOME:this.setVisible(false); new title().setVisible(true);

DELETE A RECORD(BOOKS)

CODING:DELETE:import java.sql.*; import javax.swing.JOptionPane; try { Class.forName("java.sql.DriverManager"); Connection con = (Connection) DriverManager.getConnection ("jdbc:mysql://localhost:3306/lib","root", "abc");

Statement stmt = null; stmt = (Statement)con.createStatement();

String s1 = t1.getText();

String query = "DELETE FROM BOOK WHERE BOOKNO = '" + s1 + "';" ; int rowsins = stmt.executeUpdate(query);

if ( rowsins == 1) JOptionPane.showMessageDialog (this,"Record DELETED successfully in the Item Table"); else JOptionPane.showMessageDialog (this,"Error during Record deletion in the Item Table"); stmt.close(); con.close();

} catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); e.printStackTrace(); }

CLEAR:t1.setText("");

EXIT:System.exit(0);

DATA VALIDATION:char ch=evt.getKeyChar(); if((ch>='a'&& ch<='z')||(ch>='A'&& ch<='Z')) { JOptionPane.showMessageDialog(this,"can't enter any character" ); evt.consume(); }

char ch=evt.getKeyChar(); if((ch>='0'&& ch<='9')) { JOptionPane.showMessageDialog(this,"can't enter any Number" ); evt.consume(); }

DISPLAY A RECORD(BOOKS)

CODING:DISPLAY:import java.sql.*; import javax.swing.JOptionPane; import javax.swing.table.*; DefaultTableModel model=(DefaultTableModel)table1.getModel(); int rows=model.getRowCount(); if(rows>0) { for(int i=0;i<rows;i++) { model.removeRow(0); }

} try { Class.forName("java.sql.DriverManager"); Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/lib","root","abc");

Statement stmt = null; stmt = con.createStatement(); String query="SELECT * FROM member"; ResultSet rs=stmt.executeQuery(query); while(rs.next()) { String s1=rs.getString("mno"); String s2=rs.getString("mname"); String s3=rs.getString("madd"); String s4=rs.getString("mstatus"); model.addRow(new Object[]{s1,s2,s3,s4}); }

CLEAR:DefaultTableModel model=(DefaultTableModel)table1.getModel(); int rows=model.getRowCount(); if(rows>0) { for(int i=0;i<rows;i++) { model.removeRow(0); } }

EXIT:System.exit(0);

DATA VALIDATION:char ch=evt.getKeyChar(); if((ch>='a'&& ch<='z')||(ch>='A'&& ch<='Z')) { JOptionPane.showMessageDialog(this,"can't enter any character" ); evt.consume(); }

char ch=evt.getKeyChar(); if((ch>='0'&& ch<='9')) { JOptionPane.showMessageDialog(this,"can't enter any Number" ); evt.consume(); }

HOME:this.setVisible(false); new title().setVisible(true);

UPDATE A RECORD(BOOKS)

CODING:UPDATE:import java.sql.*; import javax.swing.JOptionPane; try { Class.forName("java.sql.DriverManager"); Connection con = (Connection) DriverManager.getConnection ("jdbc:mysql://localhost:3306/lib", "root", "abc");

Statement stmt = null; stmt = con.createStatement(); String s1 =text1.getText();

String s2 =text2.getText(); String s3 =text3.getText(); String s4 =text5.getText(); String s5 =text6.getText(); String query = "UPDATE BOOK SET bname = '" + s2 + "' , pname = '" + s3 + "',price='" +s4+ "',bstatus='"+s5+"' WHERE bookno = '" + s1 + "'" ; int rowsins = stmt.executeUpdate(query);

if ( rowsins == 1) JOptionPane.showMessageDialog (this,"Record modified successfully in the Item Table"); else JOptionPane.showMessageDialog (this,"Error during Record modification in the Item Table"); stmt.close(); con.close();

} catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); e.printStackTrace(); }

CLEAR:text1.setText(""); text2.setText(""); text3.setText(""); text5.setText(""); text6.setText("");

EXIT:System.exit(0);

DATA VALIDATION:char ch=evt.getKeyChar(); if((ch>='a'&& ch<='z')||(ch>='A'&& ch<='Z')) { JOptionPane.showMessageDialog(this,"can't enter any character" ); evt.consume(); }

char ch=evt.getKeyChar(); if((ch>='0'&& ch<='9')) { JOptionPane.showMessageDialog(this,"can't enter any Number" ); evt.consume(); }

HOME:this.setVisible(false); new title().setVisible(true);

ADD A RECORD(MEMBERS)

CODING:ADD:import java.sql.*; import javax.swing.JOptionPane; try { Class.forName("java.sql.DriverManager"); Connection con = (Connection) DriverManager.getConnection ("jdbc:mysql://localhost:3306/lib","root", "abc");

Statement stmt = null; stmt = con.createStatement(); String s1 = text1.getText(); String s2 = text2.getText(); String s3 = text3.getText(); String s4 = text4.getText();

String query = "INSERT INTO member VALUES ( '" + s1 + "' , '" + s2 + "' , '" + s3 + "','"+s4+"');" ; int rowsins = stmt.executeUpdate(query);

if ( rowsins == 1) JOptionPane.showMessageDialog (this,"Record added successfully into the Item Table"); else JOptionPane.showMessageDialog (this,"Error during Record addition into the Item Table"); stmt.close(); con.close();

} catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); e.printStackTrace(); }

CLEAR:text1.setText(""); text2.setText(""); text3.setText(""); text4.setText("");

EXIT:System.exit(0);

DATA VALIDATION:char ch=evt.getKeyChar(); if((ch>='a'&& ch<='z')||(ch>='A'&& ch<='Z')) { JOptionPane.showMessageDialog(this,"can't enter any character" );

evt.consume(); }

char ch=evt.getKeyChar(); if((ch>='0'&& ch<='9')) { JOptionPane.showMessageDialog(this,"can't enter any Number" ); evt.consume(); }

HOME:this.setVisible(false); new title().setVisible(true);

DELETE A RECORD(MEMBERS)

CODING:DELETE:import java.sql.*; import javax.swing.JOptionPane; try { Class.forName("java.sql.DriverManager"); Connection con = (Connection) DriverManager.getConnection ("jdbc:mysql://localhost:3306/lib","root", "abc");

Statement stmt = null; stmt = (Statement)con.createStatement();

String s1 = text1.getText();

String query = "DELETE FROM MEMBER WHERE MNO = '" + s1 + "';" ; int rowsins = stmt.executeUpdate(query);

if ( rowsins == 1) JOptionPane.showMessageDialog (this,"Record DELETED successfully in the Item Table"); else JOptionPane.showMessageDialog (this,"Error during Record deletion in the Item Table"); stmt.close(); con.close();

} catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); e.printStackTrace(); }

CLEAR:text1.setText("");

EXIT:System.exit(0);

DATA VALIDATION:char ch=evt.getKeyChar(); if((ch>='a'&& ch<='z')||(ch>='A'&& ch<='Z')) { JOptionPane.showMessageDialog(this,"can't enter any character" ); evt.consume(); }

char ch=evt.getKeyChar();

if((ch>='0'&& ch<='9')) { JOptionPane.showMessageDialog(this,"can't enter any Number" ); evt.consume(); }

HOME:this.setVisible(false); new title().setVisible(true);

DISPLAY A RECORD(MEMBERS)

CODING:DISPLAY:import java.sql.*; import javax.swing.JOptionPane; import javax.swing.table.*; DefaultTableModel model=(DefaultTableModel)table1.getModel(); int rows=model.getRowCount(); if(rows>0) { for(int i=0;i<rows;i++) { model.removeRow(0); } } try { Class.forName("java.sql.DriverManager");

Connection con = (Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/lib","root","abc");

Statement stmt = null; stmt = con.createStatement(); String query="SELECT * FROM member"; ResultSet rs=stmt.executeQuery(query); while(rs.next()) { String s1=rs.getString("mno"); String s2=rs.getString("mname"); String s3=rs.getString("madd"); String s4=rs.getString("mstatus"); model.addRow(new Object[]{s1,s2,s3,s4}); } stmt.close(); con.close();

} catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); e.printStackTrace(); }

CLEAR:DefaultTableModel model=(DefaultTableModel)table1.getModel(); int rows=model.getRowCount(); if(rows>0) { for(int i=0;i<rows;i++) { model.removeRow(0); }

EXIT:System.exit(0);

DATA VALIDATION:char ch=evt.getKeyChar(); if((ch>='a'&& ch<='z')||(ch>='A'&& ch<='Z')) { JOptionPane.showMessageDialog(this,"can't enter any character" ); evt.consume(); }

char ch=evt.getKeyChar(); if((ch>='0'&& ch<='9')) { JOptionPane.showMessageDialog(this,"can't enter any Number" ); evt.consume(); }

HOME:this.setVisible(false); new title().setVisible(true);

UPDATE A RECORD(MEMBERS)

CODING:UPDATE:try { Class.forName("java.sql.DriverManager"); Connection con = (Connection)DriverManager.getConnection("jdbc:mysql://localhost:3306/lib","root","abc");

Statement stmt = null; stmt = con.createStatement(); String s1 =text1.getText(); String s2 =text2.getText(); String s3 =text3.getText(); String s4 =text4.getText(); String query = "UPDATE MEMBER SET mname = '" + s2 + "' , madd = '" + s3 + "' ,mstatus='" +s4+ "' WHERE mno = '" + s1 + "'" ; int rowsins = stmt.executeUpdate(query);

if ( rowsins == 1) JOptionPane.showMessageDialog(this,"Record modified successfully in the MEMBER Table"); else JOptionPane.showMessageDialog(this,"Error during Record modification in the MEMBER Table"); stmt.close(); con.close();

} catch (Exception e) { JOptionPane.showMessageDialog(this, e.getMessage()); e.printStackTrace(); }

CLEAR:text1.setText(""); text2.setText(""); text3.setText(""); text4.setText("");

EXIT:System.exit(0);

DATA VALIDATION:char ch=evt.getKeyChar(); if((ch>='a'&& ch<='z')||(ch>='A'&& ch<='Z')) { JOptionPane.showMessageDialog(this,"can't enter any character" ); evt.consume(); }

char ch=evt.getKeyChar(); if((ch>='0'&& ch<='9'))

{ JOptionPane.showMessageDialog(this,"can't enter any Number" ); evt.consume(); }

HOME:this.setVisible(false); new title().setVisible(true);

THANK YOU

CODING:THANK YOU:JOptionPane.showMessageDialog(this,"Thanks for Signing In" );

You might also like