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
Ads
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.
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
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
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 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
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
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
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
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
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
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
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
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