Free Support Forum - aspose.com

Problem with cell.importResultSet(); method

hi


when i try to run that method cell.importResultSet()
it showing me the error like
conversion to string failed
plz help


Thanks

actually in resultset i do have clob data so how can i handle it ?


Hi,

Thanks for your reporting.

Did you try the code example in this document? Importing from
ResultSet


I think, you should remove the column with clob data in your result set as told below.

The better way to get rid of one column is to use the following method instead:

int com.aspose.cells.Cells.importResultSet(ResultSet rs, int rowIndex, int columnIndex, int rowNum, int columnNum, boolean isFieldNameShown) throws SQLException

where for rowNum you can input -1 to import all records in the resultset but columnNum is the total column count minus 1 to exclude the last column. For the total columns count of one ResultSet, it is easy to get by following code:

ResultSetMetaData meta = rs.getMetaData();
columnNum = meta.getColumnCount();


I don’t have info about the clob field where it present in result set

Can u suggest me some solution for this case

Thanks

Hi,

I think, ResultSetMetaData will have your answer.

e.g you can try this code to find the types of your column in a loop and look for clob type column.

Java


ResultSetMetaData meta = rs.getMetaData();
columnNum = meta.getColumnCount();

int columnType = meta.getColumnType();

//then get the column type name
String columnTypeName = meta.getColumnTypeName();

Please explore more options about ResultSetMetaData at the given link.

Hi,

We have enhanced Cells.importResultSet() method to catch such kind of exception for CLOB columns. However, it is better for you to remove the CLOB column from your query because the converted String value from CLOB for a Cell may be not what you desired. Please try this new fix.

Please download: Aspose.Cells for Java v2.5.4.13

Got the Idea ThankYou