Guest User

Untitled

a guest
Apr 18th, 2018
107
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.03 KB | None | 0 0
  1. String desde1=txtDesde.getText();
  2. String hasta1=txtHasta.getText();
  3. Class.forName("com.mysql.jdbc.Driver");
  4. cn=(Connection) DriverManager.getConnection("jdbc:mysql://localhost/","root","");
  5. ps=(PreparedStatement) cn.prepareStatement("select Item,Fecha,N_acta,Descripcion,"
  6. + "Cantidad,Tipo_moneda,Condicion,Ape_pa,Ape_ma,"
  7. + "Nombres,Nacionalidad,Tipo_doc,Dni,Direccion,Distrito,Provincia,Departamento,Jefe_sala,"
  8. + "Modalidad from premio1"+ " WHERE N_acta BETWEEN'"+desde1+"'AND'"+hasta1+"'");
  9.  
  10. rs=ps.executeQuery();
  11. rsm=(ResultSetMetaData) rs.getMetaData();
  12. ArrayList<Object[]>data=new ArrayList<>();
  13. while(rs.next()){
  14. Object[] rows=new Object[rsm.getColumnCount()];
  15. for(int i = 0; i < rows.length; i++ ){
  16. rows[i]=rs.getObject(i+1);
  17. }
  18. data.add(rows);
  19. }
  20. dtm=(DefaultTableModel)this.jReportePremio.getModel();
  21. for(int i=0; i<data.size();i++){
  22. dtm.addRow(data.get(i));
  23. }
Add Comment
Please, Sign In to add comment