Help on this java code for online library search

Help on this java code for online library search

I have written the following java code for simple library book search. but its having some errors ... please help me on this code.

import java.sql.*;
import java.awt.*;
import java.awt.event.*;
import javax.swing.*;
import javax.swing.table.*;

public class Library
{
 JRadioButton rbauthor = new JRadioButton("Search by Author name");
 JRadioButton rbbook = new JRadioButton("Search by Book name");
 JTextField textfld = new JTextField(30);
 JLabel label = new JLabel("Enter Search Key");
 JButton searchbutton = new JButton("Search");
 JFrame frame = new JFrame();
 JTable table;
 DefaultTableModel model;
 String query = "select * from Library";

 public Library()
 {
  frame.setTitle("Online Public Access Catalog");
  frame.setSize(500,600);
  frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
  frame.setLayout(new BorderLayout());

  JPanel p1 = new JPanel();
  JPanel p2 = new JPanel();
  JPanel p3 = new JPanel();

  p1.setLayout(new FlowLayout());
  p1.add(label);
  p1.add(textfld);

  ButtonGroup bg = new ButtonGroup();
  bg.add(rbauthor);
  bg.add(rbbook);

  p2.setLayout(new FlowLayout());
  p2.add(rbauthor);
  p2.add(rbbook);
  p2.add(searchbutton);
  searchbutton.addActionListener(this);

  p3.setLayout(new BorderLayout());
  p3.add(p1,BorderLayout.NORTH);
  p3.add(p2,BorderLayout.CENTER);

  frame.add(p3,BorderLayout.NORTH);
  addTable(query);
  frame.setVisible(true);
 }
 public void addTable(String s)
 {
  try
  {
   Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
   Connection conn = DriverManager.getConnection("jdbc:odbc:Library","","");
   Statement st = conn.createStatement();

   ResultSet rs = st.executeQuery(s);
   ResultSetMetaData md = rs.getMetaData();
   int cols = md.getColumnCount();
   model = new DefaultTableModel(1,cols);
   table = new JTable(model);
   String[] tabledata = new String[cols];
   int i=0;
   while(i<0)
   {
    model.removeRow(0);
    frame.remove(table);
    addTable(query);
   }
  }
  catch(Exception e)
  {
  }
 }
 public static void main(String args[])
 {
  new Library();
 }
} 
View Answers









Related Tutorials/Questions & Answers:
Help on this java code for online library search
Help on this java code for online library search   I have written the following java code for simple library book search. but its having some errors ... please help me on this code. import java.sql.*; import java.awt.
CAN U HELP ME TO CODE IN JSP FOR ONLINE VOTING SYSTEM
CAN U HELP ME TO CODE IN JSP FOR ONLINE VOTING SYSTEM  can u help me to code in jsp for online voting system
Advertisements
help to write java code
help to write java code  write a full code to produce a system will calculate all items to get total carry-marks which are 60 marks. and get sum of assignment 1,assignment 2, midterms-test and lave work to get total marks
help to write java code
help to write java code  write a full code to produce a system will calculate all items to get total carry-marks which are 60 marks. and get sum of assignment 1,assignment 2, midterms-test and lave work to get total marks
Java Programming Code HELP
Java Programming Code HELP  Hi, sir/madam. I am new here and currently developing a program whereby it can read the Java source file...: String, attribute name = variable name) Below are my source code. Hope
Java code help
Java code help  Write a java program that will ask the user to input any number from 5 to 9 and then print the following structure depending on the user input. E.g. If the user input is 5, then print the following structure 1 2 3
online voting system source code in java
online voting system source code in java  Please send me source code for online voting system in java. please replay as fast as. Thank you
online shopping project report with source code in java
online shopping project report with source code in java  Dear Sir/Mam, i want to a project in java with source code and report project name online shopping. thank you
online library management
online library management  how to divert user from log in page to home page depending on their category(like student or staff in case of ol library) using java servlet
java code to search in your hard disck
java code to search in your hard disck  Build a search engine which would scan your hard disk and build an inverted index for your files. The search engine should cluster your files according to some criteria and make some
Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems
Plz help me in writing the code - Java Beginners
Plz help me in writing the code   Write a two user Chess Game. (users must be on different systems
code for timer in java netbeans for online test series countdown timer
code for timer in java netbeans for online test series countdown timer  code for timer in java netbeans for online test series countdown timer
ONLINE EXAM CODE SPLIT
ONLINE EXAM CODE SPLIT  hi.. im developing online exam for c programming in jsp.. i read the question from database as a string suppose String...(){ int i; for(i=0;<100;i++){ printf("hai"); } } how is it possible? plz plz help
online shopping code using jsp
online shopping code using jsp  plz send me the code of online shopping using jsp or jdbc or servlets plz plz help me
email search code in php
email search code in php  email search with multiple option in php
run php code online
run php code online  Is it possible to run PHP Code online
Please help me to modify my java code from php code
Modify Java code from PHP Code  i want to covert this php code int java/JSP. if (isset($_POST['orders'])) { $orders = explode('&', $_POST... the exact result as the above PHP code is giving. So please help me to convert
please help me to give code - Java Beginners
please help me to give code  Write a program that prints an n-level stair case made of text. The user should choose the text character..., http://www.roseindia.net/java
please help me to give code - Java Beginners
please help me to give code  Write a program that reads a file named famous.txt and prints out the line with the longest length. In the case...(); } } } ------------------------------- read for more information, http://www.roseindia.net/java/beginners/read
please help me to give code - Java Beginners
please help me to give code  Write a function, sliding(word, num)that behaves as follows. It should print out each slice of the original word having length num, aligned vertically as shown below. A call to sliding(examples, 4
please help me to give code - Java Beginners
please help me to give code  Write a function with a signature cheerlead(word) that prints a typical cheer as follows. The word robot: Gimme an R Gimme an O Gimme a B Gimme an O Gimme a T What did you give me? ROBOT
please help me to give code - Java Beginners
please help me to give code  Write a program that uses loops to generate an n x n times table. The program should get n from the user. As a model here is a 4 x4 version: | 1 2 3 4
Please help me to modify my java code from php code
Please help me to modify my java code from php code  i want to covert this php code int java/JSP . if (isset($_POST['orders'])) { $orders... help me to convert it into Java. if (request.getParameter("orders") != null
ModuleNotFoundError: No module named 'odoo10-addon-help-online'
ModuleNotFoundError: No module named 'odoo10-addon-help-online'  Hi...: No module named 'odoo10-addon-help-online' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-help-online' error? Thanks  
ModuleNotFoundError: No module named 'odoo10-addon-help-online'
ModuleNotFoundError: No module named 'odoo10-addon-help-online'  Hi...: No module named 'odoo10-addon-help-online' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-help-online' error? Thanks  
ModuleNotFoundError: No module named 'odoo10-addon-help-online'
ModuleNotFoundError: No module named 'odoo10-addon-help-online'  Hi...: No module named 'odoo10-addon-help-online' How to remove the ModuleNotFoundError: No module named 'odoo10-addon-help-online' error? Thanks  
ModuleNotFoundError: No module named 'odoo8-addon-help-online'
ModuleNotFoundError: No module named 'odoo8-addon-help-online'  Hi...: No module named 'odoo8-addon-help-online' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-help-online' error? Thanks   
ModuleNotFoundError: No module named 'odoo8-addon-help-online'
ModuleNotFoundError: No module named 'odoo8-addon-help-online'  Hi...: No module named 'odoo8-addon-help-online' How to remove the ModuleNotFoundError: No module named 'odoo8-addon-help-online' error? Thanks   
ModuleNotFoundError: No module named 'odoo9-addon-help-online'
ModuleNotFoundError: No module named 'odoo9-addon-help-online'  Hi...: No module named 'odoo9-addon-help-online' How to remove the ModuleNotFoundError: No module named 'odoo9-addon-help-online' error? Thanks   
Source Code for Search Engine Project in java - Java Beginners
Source Code for Search Engine Project in java  Hello Sir ,I want Java Project for Search Engine(like google),How I can Make it,Plz Give Me Complete Source Code Of Search Engine Project in Java.  Hi Friend, Please
secure online payment code for jsp
secure online payment code for jsp   how to implements online payment in jsp
Please help with this code
Please help with this code  I need some help getting the Search...) Display the lowest grade"); System.out.println("(5) Search for specific result"); System.out.println("(6) Search for student grade by name
Help in completing Servlet code!
Help in completing Servlet code!  Complete the following Servlet codes to store the information read from the input form to session object. public... String comment = req.getParameter(?commentText?); //Complete the code to store
Calender code ! HELP!!!
Calender code ! HELP!!!  how can i add 3 days to current date ? i am.... i am working on a school project & i really need help on this!!!ADS_TO_REPLACE_1 Please help me. This is my code: var Calendar = Class.create();ADS
Code Help Needed
Code Help Needed  I am trying to help a buddy of mine with this program and I can't seem to figure it out. I am still working on it but any help...[test]); line. Again thank you for any help. import java.util.*; import
Pleae help me to give logic and code for this program - Java Beginners
Pleae help me to give logic and code for this program  Write a function that given the string ?original? create a new string ?dramatic? that has two...://www.roseindia.net/java/beginners/StringReverseUsingStringUtils.shtml
more code help
more code help  Instructions: Write a program to translate a message from English to Morse code. Using a simple text editor like Windows Notepad, create a text file with all of the Morse code combinations for the letters
beginner need help with online ordering program please
beginner need help with online ordering program please  I have created a program for an online ordering system and now have to add error handling and a few other things my teacher doesn't teach well is there a template I can go
How to code a Product id search engine?
How to code a Product id search engine?  I always wonder how people here are such greatly helpful. I have about a 30 rare products in my online store(just showcasing, we don't sell) each with a specific id. I am trying to code
javascript code for search in html file
javascript code for search in html file  Hi, I am looking for javascript code through which we can search data with specific name find in any rows... e .......... Search: P002 After search result would be show like below format
I need help on my Java code.... please please help me out!?
I need help on my Java code.... please please help me out!?  Well my code is supposed to ask for an input file and then (ex: input.txt), read... in the file. Also it should be displayed on the screen. However my code doesn't display
ModuleNotFoundError: No module named 'BIT-Online-Code-Helper'
library, ModuleNotFoundError: No module named 'BIT-Online-Code-Helper'...ModuleNotFoundError: No module named 'BIT-Online-Code-Helper'  Hi...: No module named 'BIT-Online-Code-Helper' How to remove the ModuleNotFoundError
Source Code for Implementing Search Feature in JSP using Java action/Servlet - JSP-Servlet
Source Code for Implementing Search Feature in JSP using Java action/Servlet  How do I write the source code to implement search feature in JSP using Java action/servlet? My query is: SELECT @rownum:[email protected]+1 'rownum', X
Html code for search - Development process
Html code for search   Hi, when i click search button .It has to display table with data. I have completed design only. Plz give code... if you want to use HTML code with JSP and Servlet to search from database
Source Code for Implementing Search Feature in JSP using Java Action/Servlet - JSP-Interview Questions
Source Code for Implementing Search Feature in JSP using Java Action/Servlet  How do I write the source code to implement search feature in JSP using... searchServlet /search Thanks  I have following your source code
need someone to do/help with code
need someone to do/help with code  i need someone to do a code for me. It is a restaurant menu that displays a list of 10 food items. A customer..., along with the number of items sold..please help did a code 500 times cant
Code for search data - Development process
Code for search data  Hi, can u give me jsp code for search data. When i select any 1 from 3, it has to display all d corresponding data from database sub-combo box in this code is not working. Search Page
help in insert code - JSP-Servlet
help in insert code  I have some doubt in following code. I want to insert value using prepared statement.we r accessing connection from other package.can u plz help me out.  hiimport java.io.*;import java.sql.*;import
could anyone please help with the code.
could anyone please help with the code.  protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException...(request, response); } } could anyone please check the code. If i enter

Ads