Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- public void showTable(){
- try{
- how.res = how.stat.executeQuery("select * from students order by name ASC limit 100");
- while(how.res.next()){
- String id = how.res.getString(1);
- String name = how.res.getString(2);
- String contact = how.res.getString(3);
- Object[] content = {id,name,contact};
- DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
- model.addRow(content);
- }
- }catch (Exception e){
- }
- }
- private void jButton3ActionPerformed(java.awt.event.ActionEvent evt) {
- // TODO add your handling code here:
- try{
- numClick+=100;
- how.res = how.stat.executeQuery("select * from students offset"+numClick+"");
- while(how.res.next()){
- String id = how.res.getString(1);
- String name = how.res.getString(2);
- String contact = how.res.getString(3);
- Object[] content = {id,name,contact};
- DefaultTableModel model = (DefaultTableModel)jTable1.getModel();
- model.addRow(content);
- }
- }catch (Exception e){
- }
- }
- public class JoinConnection {
- public Connection con;
- public Statement stat;
- public ResultSet res;
- public JoinConnection(){
- systemConnection();
- }
- public void systemConnection(){
- try{
- Class.forName("com.mysql.jdbc.Driver");
- con =(com.mysql.jdbc.Connection) DriverManager.getConnection("jdbc:mysql://localhost:3306/library","root","");
- stat = (Statement) con.createStatement();
- }catch(ClassNotFoundException | SQLException e){System.out.println(e);}
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement