RowSetDynaClass

S

sn1022

I am trying to use the RowSetDynaClass to retrieve
resultsets in a dynamic fashion, as can be seen in the
getRowSet() function here:


public RowSetDynaClass getRowSet() throws Exception
{
RowSetDynaClass rowset = null;

try{
//This is for the select list box
PreparedStatement prestmt = con.prepareStatement("SELECT " +
"EMPID, FNAME, LNAME " +
"FROM EMP");

ResultSet rs = prestmt.executeQuery();
rowset = new RowSetDynaClass(rs);
}finally{if(con!=null) con.close();}

return rowset;
}
(con is already set)

The problem is, the entire program crashes when I put in the following
try/catch block into the perform() method (the getRowSet() and the
action perform are in the same class) to call the RowSetDynaClass
getRowSet() function. The block is:

try{
RowSetDynaClass rowset = getRowSet(); //for complex
dynamic resultsets
request.setAttribute("rowset", rowset);
}catch(Exception e)
{System.out.println(e);
}

This block makes the program crash. Otherwise, the
program works perfectly. I was wondering if perhaps
there is some sort of syntactical error, etc. here?

Thank you for your help.
~Sunil
 
W

Wendy Smoak

sn1022 said:
This block makes the program crash. Otherwise, the
program works perfectly. I was wondering if perhaps
there is some sort of syntactical error, etc. here?

If it had a syntax error, it wouldn't compile. What error message do you
get?
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,598
Members
45,151
Latest member
JaclynMarl
Top