samedi 19 avril 2014

How to display search item in Jtable?


Vote count:

0




I am not able to search a particular item from the database and put it into the Jtable here is the code i am using:



try{
String filename="stock.mdb";
String database="jdbc:odbc:Driver={Microsoft Access Driver (*.mdb)};DBQ=";
database += filename.trim()+ ";DriverID=22;READONLY=FALSE}";
conn=DriverManager.getConnection (database, "", "");


Statement sta= conn.createStatement();
String str=search.getText();
String sql="SELECT '"+str+"' FROM stockDB";
ResultSet rs= sta.executeQuery(sql);
Table.setModel(DbUtils.resultSetToTableModel(rs));

System.out.println("SEARCH UPDATED");

}catch(Exception e)
{
System.out.println(e);


}


What is wrong with it?



asked 38 secs ago






Aucun commentaire:

Enregistrer un commentaire