Free Support Forum - aspose.com

Import data from Oracle database into workbook using Aspose.Cells for .NET in C#

Hello

What would be the best way to import data into Cells from database ? We are using Oracle database (9.2.0.5) and ODP.Net (Oracle.DataAccess - 2.102.2.20) . When we tried to use Cells.ImportDataTable, some of the queries gave a .Net error "Arithmetic operation resulted in an overflow", while populating the datatable.

In some of the postings in Oracle forums , it has been said to use Oracle Safetype mapping to avoid this issue. This would cause a problem for us. If we convert decimal types in the database to string, while loading the datatable, the resultant excel files will lose the data type.

Have you seen this issue before ?

Is there any workaround for these type of issues ?

Please let me know.

Thanks.

Hi,

Which version of the product you are using? Kindly try out latest version (Latest Version), you may download the version from here:
https://downloads.aspose.com/cells/net
Thank you

Hi

I downloaded / installed the version 4.9.0.

Does this version provide any solution to the issue I mentioned in my initial post ?

Please let us know.

Thanks,

Thahseen

Hi,

If you still find any issue with the new v4.9.0, kindly do create a sample console application, zip it and post it here to show the issue, we will check it soon.

Thank you.

Hi Amjad

Basically, I am trying to export data from an Oracle database to an Excel file.

What would be the best of doing that using Odp.net , (other than first loading the data to a DataTable and then using ImportDataTable ) ?

Thanks,

Thahseen

Thanks for your support.

I was able to reach a solution by myself.

As I mentioned earlier, OracleDataReader was raising error -

"Arithmetic operation resulted in an overflow."

I used OracleDataAdapter - SafeMapping - to convert all the decimal data types to string and kept track of all these converted columns in a List.

After loading the data to the datatable, I converted the data type - modifed - columns to their original data type and then used import Cells.ImportDataTable method.

Thanks again.

Thahseen