How do I get a subset of a result set
I am getting a result set from a remote data source. After the resultset is returned how can I do a select on the result to return a subset of records?
My code:
package com.drawingpdmw1;
import java.sql.*;
import com.ibm.as400.access.*;
/**
* @author sde
*
* TODO To change the template for this generated type comment go to
* Window - Preferences - Java - Code Style - Code Templates
*/
publicclass getLastDashNumberConnection{
public String errorString;
public String literalerrorString;
public String maxRecSeq;
public getLastDashNumberConnection(String arg0){
AS400JDBCDataSource datasource =new AS400JDBCDataSource("gvas400");
datasource.setTranslateBinary(true);
datasource.setUser("drawchg");
datasource.setPassword("webabc1");
try{
Connection connection = datasource.getConnection();
Statement stmt = connection.createStatement();
String sql ="select distinct dmdrawno from webprddt6.drawmext3 Where dmdrawno LIKE '%" + arg0.substring(0,6) +"%'";
ResultSet rs = stmt.executeQuery(sql);
while(rs.next()){
System.out.println(rs.getString("dmdrawno").trim());
}
errorString ="";
literalerrorString ="NoError";
}
catch(SQLException sqle){
System.out.println("Error");
System.out.println(sqle);
errorString ="Warning!!! A New Dash Number could not be created!";
literalerrorString ="Error";
}
}
}

