Page 1 of 1

Not able to search data

PostPosted: Mon Jun 01, 2009 6:28 pm
by husstha
I have created java program which is for Library management system, in this program Im not able to search book from book table. search class is running well but not displaying data from book table. Its show message when I enter the ID "Record is not found".
Please any one is there to find me a solution soon.



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

public class SearchBook extends JFrame implements ActionListener {

private JPanel pBook = new JPanel ();
private JLabel lbSearch;
private JRadioButton rb1,rb2,rb3,rb4;
private JTextField txtSearch;
private JButton btnFind, btnCancel;
private int flag=0;
private Statement st;
private String bname,bauthor,bcat,search;
private int bmid,bid,rows=0;
private JTable table;
private JScrollPane jsp;
private Object data1[][];
private Container c;

public SearchBook () {


super ("Search Books");
//setDefaultCloseOperation(javax.swing.WindowConstants.EXIT_ON_CLOSE);

lbSearch = new JLabel ("Search Field");
lbSearch.setForeground (Color.black);
lbSearch.setBounds (15, 15, 100, 20);

txtSearch = new JTextField ();
txtSearch.setBounds (120, 15, 175, 25);


btnFind = new JButton ("Find Book");
btnFind.setBounds (25, 175, 125, 25);
btnFind.addActionListener (this);
btnCancel = new JButton ("Cancel");
btnCancel.setBounds (165, 175, 125, 25);
btnCancel.addActionListener (this);

rb1=new JRadioButton("By Title");
rb1.addActionListener(this);
rb1.setBounds (15, 45, 100, 20);
rb2=new JRadioButton("By Author");
rb2.addActionListener(this);
rb2.setBounds (15, 75, 100, 20);
rb3=new JRadioButton("By Category");
rb3.addActionListener(this);
rb3.setBounds (15, 105, 100, 20);
rb4=new JRadioButton("By id");
rb4.addActionListener(this);
rb4.setBounds(15,135,100,20);

pBook.setLayout (null);
pBook.add(lbSearch);
pBook.add(txtSearch);
pBook.add(btnFind);
pBook.add(btnCancel);
ButtonGroup bg=new ButtonGroup();
bg.add(rb1);
bg.add(rb2);
bg.add(rb3);
bg.add(rb4);
pBook.add(rb1);
pBook.add(rb2);
pBook.add(rb3);
pBook.add(rb4);
rb1.setSelected(true);
this.add (pBook, BorderLayout.CENTER);
c=getContentPane();



setSize(400,250);
setVisible (true);
setLocation(400,400);


}

public void actionPerformed (ActionEvent ae) {

Object obj = ae.getSource();

if (obj == btnFind) { //If Find Button Pressed.

if (txtSearch.getText().equals ("")) {
JOptionPane.showMessageDialog (this, "Search Field not Provided.");
txtSearch.requestFocus ();
}
else
{

String bname1,bauthor1,bcat1;
int num;
boolean found = false; //To Confirm the Book's Id Existance.
Connection con=null;
String url= "jdbc:odbc:CityLibrary";
Statement st=null;
try { //SELECT Query to Retrieved the Record.


Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
con=DriverManager.getConnection(url);
st = con.createStatement();

String q,bavl,bisr;
//num=st.executeUpdate("Delete * from bksearch");
ResultSet rs = st.executeQuery ("SELECT * FROM bk"); //Executing the Query.


search=txtSearch.getText();
search=search.toLowerCase();
//search=search.trim();


while(rs.next())
{

bname=rs.getString(2);
bauthor=rs.getString("bauthor");
bcat=rs.getString("bcat");

bmid=rs.getInt("Statuss");
if(bmid==0) bavl="Available";
else bavl="Issued:"+ bmid;
bid=rs.getInt("bookid");

if(flag==0)
{
bname1=bname.toLowerCase();
if(bname1.equals(search)||(bname1.indexOf(search)!=-1))
{
System.out.println("Came Here2");
//num = st.executeUpdate("insert into bksearch values(" + bid + ", '" + bname + "' , '" + bcat + "' , '" + bauthor + "')");
//ResultSet rs = st.executeQuery("SELECT * FROM bk");
rows++;
found=true;
System.out.println("bookname");
}
}
else if(flag==1)
{
bauthor1=bauthor.toLowerCase();
if(bauthor1.equals(search)||(bauthor1.indexOf(search)!=-1))
{
//num = st.executeUpdate("insert into bksearch values(" + bid + ", '" + bname + "' , '" + bcat + "' , '" + bauthor + "')");
//ResultSet rs = st.executeQuery("SELECT * FROM bk");

rows++;
found=true;
System.out.println("author");
}
}
else if(flag==2)
{
bcat1=bcat.toLowerCase();
if(bcat1.equals(search)||(bcat1.indexOf(search)!=-1))
{
//num=st.executeUpdate("insert into bksearch values("+bid+", '"+bname+"' , '"+bcat+"' , '"+bauthor+"')");
//ResultSet rs = st.executeQuery("SELECT * FROM bk");
rows++;
found=true;
System.out.println("catagory");
}
}
else if(flag==3)
{
if(bid==Integer.parseInt(txtSearch.getText()))
{
//ResultSet rs = st.executeQuery("SELECT * FROM bk");
rows++;
//num=st.executeUpdate("insert into bksearch values("+bid+", '"+bname+"' , '"+bcat+"' , '"+bauthor+"')");
//num=st.executeUpdate("insert into bksearch values("+bid", '"bname"','"bcat"','"bauthor"')");

found=true;
System.out.println("id");
}
}

}



}
catch(SQLException ex)
{
if (found == false) {
JOptionPane.showMessageDialog (this, "Record not Found.");
}
}
catch(ClassNotFoundException ex)
{
System.out.println("Class not found");
}
catch(Exception ex)
{
System.out.println("Exception raised is:"+ex);
}
if(found==true){

try{
data1=new Object[rows][5];

Object[] Colheads={"Book Id","Book Name","Category","Author","Availability"};
ResultSet rs=st.executeQuery("Select * from bk");

for(int i1=0;i1<rows;i1++)
{
rs.next();
for(int j1=0;j1<5;j1++)
{
data1[i1][j1]=rs.getString(j1+1);
}
}
rs.close();
st.close();
con.close();
table=new JTable(data1,Colheads);
int v=ScrollPaneConstants.VERTICAL_SCROLLBAR_AS_NEEDED;
int h=ScrollPaneConstants.HORIZONTAL_SCROLLBAR_AS_NEEDED;
System.out.println("hai we came here");
jsp=new JScrollPane(table,v,h);
TableDisp td=new TableDisp(table);


}
catch(Exception sqlex) {
if (found == false) {
JOptionPane.showMessageDialog (this, "Some prob Found.");
}
}
}
}

}

if (obj == btnCancel) { //If Cancel Button Pressed Unload the From.

setVisible (false);
dispose();

}

if(obj==rb1)
{
flag=0;
}
if(obj==rb2)
{
flag=1;
}
if(obj==rb3)
{
flag=2;
}
if(obj==rb4)
{
flag=3;
}

}
public static void main(String[] args)
{
SearchBook sbb=new SearchBook();


}
}

free pilipino movies

PostPosted: Thu Oct 01, 2009 7:54 pm
by Unjuchchede
ellen
pilipinas
tagalog
pasko
alamat
sa
english
ilocano
learn
tagalog
translator
pasko
pilipinas
translate
from
ko
translator
food
ang
pinoy
dvd
learning
translator
song
translator
to
movies
store
english
translator
philippines
filipino
philippines
philippines
bible
ko
shirts
mga
tagalog
lyrics
abs
language
ng
jokes
sa
download
pinoy
in
sa
translate
tagalog
the
movie
translation
ang
tagalog
bahay
russian
download
ng
speak
to
lyrics
words
learning
alamat
spanish
dvd
ang
tagalog
to
pinoy
philippines
pinoy
store
online
pilipinas
philippines
english
movie
free
movie
download
philippine
lyrics
movies
translator
translation
pilipino
words
kanta
philippines
to
shirts
song
pasko
tagalog
filipino
na
mga
movie
movies
pilipino
pasko
rental
free
philippines
dvd
ko
sa
to
spanish
of
summary
english
clothing
translation
english
download
ng
online
translation
movies
language
rental
music
lola
shirts
music
summary
movies
movies
dvd
shirts
pinoy
movies
translation
online
to
ang
isang
filipino
philippine
dvd
movies
video
ilocano
pilipinas
bahay
pasko
pilipinas
clothing
online
na
filipino
music
philippine
language
filipino
online
language
na
pinoy
ikaw
mp
dvd
translate
ilocano
jokes
phrases
mp
pilipino
pasko
ilocano
translation
ang
english
ang
translation
english
rental
shirt
translator
pinoy
pilipinas
for
music
pilipino
speak
philippine
ang
tagalog
philippine
translation
words
tagalog
english
sining
learn
free
philippines
movies
translation
songs
downloads
ko
sa
isang
movie
translator
english
shirts
video
rental
buhay
dictionary
phrases
ko
movies
movies
video
music
tagalog
philippines
translation
english
store
na
pilipinas
movies
movies
language
movies
english
speak
isang
translation
isang
learn
translator
mga
online
tagalog
ang
philippines
pilipino
mp
movies
movies
na

iforexvideo.com - Great Website

PostPosted: Mon Nov 16, 2009 10:40 am
by NuamouroFug
I like this web really much.

This is such a great place.

This is not like other money directed website, the content here is really important.

I am definitely bookmarking it as well as sharin it with my friends.
_______________
System Trading






















































































































Forex Video
Forex
Acm Forex
Forex Course
Cms Forex
Forex Courses
Forex News
Forex Made Easy
Forex Education
Learn To Trade Forex
Forex Charts
Learning Forex
Forex Trading Systems
Forex Chart
Forex Training
Free Forex Charts
Forex Signals
Forex Trading Software
Forex Charting
Forex Trading Signals
Forex Strategy
Forex Software
Forex Demo
Forex Market
Foreign Exchange Trading
Forex Trading System
Forex Strategies
How To Trade Forex
Forex Currency
Forex Trading Strategies
Forex Platform
Forex Brokers
Forex Traders
Forex Technical Analysis
Fx Trading
Online Forex
Forex Analysis
Forex Factory
Forex Trading
Forex Trades
Forex Forum
Learn Forex
Forex Managed Account
Forex Tutorial
Trade Forex
Online Currency Trading
Currency Trading
Forex Managed Accounts
Scalping Forex
Forex Demo Account
Forex Real Time
Forex Trading Platform
Forex Capital
Forex Trader
Forex Broker
Managed Forex
Forex Seminar
Forex Mini
Forex Live
Forex Day Trading
Forex Investing
Forex Tips
Forex Book
Best Broker Forex
Forex Alert
Forex Account
Forex Accounts
Forex Rate
Forex Rates
Forex Management
Forex Jobs
Forex World
Forex Dealer
Forex Internet
Forex Information
Global Forex
Forex Markets
Foreign Exchange Forex
Forex Systems
Forex Blog
Forex Currency Exchange
Trading Currencies
Forex Profit
Forex Review
Forex Books
Best Forex
Forex Futures
Automated Forex
The Forex
Forex Info
Forex Pips
Forex Pip
Forex Guide
Free Forex Signals
Vex Forex
Forex Spread
Forex Day
http://www.iforexvideo.com/forex-strate ... o-explore/
http://www.iforexvideo.com/forex-system ... important/
http://www.iforexvideo.com/forex-exchan ... -accounts/
http://www.iforexvideo.com/forex-market ... ing-tools/
http://www.iforexvideo.com/the-dynamics ... -analysis/
http://www.iforexvideo.com/forex-autopilot-review/
http://www.iforexvideo.com/forex-strate ... rstanding/
http://www.iforexvideo.com/forex-autopi ... g-systems/
http://www.iforexvideo.com/foreign-curr ... -involved/
http://www.iforexvideo.com/forex-system ... important/
http://www.iforexvideo.com/forex-system ... ding-plan/
http://www.iforexvideo.com/the-merrill- ... trategies/
http://www.iforexvideo.com/forex-strate ... o-explore/
http://www.iforexvideo.com/day-forex-%e ... otentials/
http://www.iforexvideo.com/forex-accoun ... ate-to-it/
http://www.iforexvideo.com/currency-tra ... %99ve-got/
http://www.iforexvideo.com/the-basics-o ... d-profits/
http://www.iforexvideo.com/leverage-com ... -momentum/
http://www.iforexvideo.com/online-curre ... -analyses/
http://www.iforexvideo.com/forex-system ... %99-staff/
http://www.iforexvideo.com/forex-rate-% ... d-by-mfis/
http://www.iforexvideo.com/forex-strate ... g-picture/
http://www.iforexvideo.com