Get Id from TextField And When jButton Click then Bind Data from Database in Jtable
int id=Integer.parseInt(jTextField22.getText());
try
{
Connection c=new Connection();
java.sql.Connection con=c.connectit();
String sql="select id,BrandName,VendorName,Description,Quantity,Category,Size,Color,PurchaseDate,SellingPrice,Product,Discount from stock where id='"+id+"'";
PreparedStatement pst=con.prepareStatement(sql);
ResultSet rs = pst.executeQuery(sql);
stock1.setModel(DbUtils.resultSetToTableModel(rs));
con.close();
pst.close();
}
catch(Exception e)
{
JOptionPane.showMessageDialog(null,e);
}