1. Per Ahlander
  2. .NET DataStore
  3. Thursday, 17 June 2021 15:50 PM UTC

Possibly the wrong category but feel free to move if so.

So i have converted some datawindow in snapdevelop. the model got some properties that are public decimai?

The problem comes when some of those fields needs more decimal precision than decimal. i think OracleDecimal would be good but when i manually switch it i get some error that it cannot map. I can Cast as number in the sql and lower the precision but i need as many decimals as possible. Anyone got any advice?

Per Ahlander Accepted Answer Pending Moderation
  1. Tuesday, 22 June 2021 05:09 AM UTC
  2. .NET DataStore
  3. # 1

So using the OracleDataReader by itself works fine.

 

using(OracleConnection con = new OracleConnection(connString))
{
using(OracleCommand cmd = con.CreateCommand())
{
con.Open();
cmd.BindByName = true;

cmd.CommandText =@"SELECT 12356789.123456789012345678901234567890 Test FROM dual";

try
{

OracleDataReader reader = cmd.ExecuteReader();
List<decimal> results = new List<decimal>();

while (reader.Read())
{
results.Add(OracleDecimal.SetPrecision(reader.GetOracleDecimal(0), 27).Value);
}

reader.Dispose();
return Ok(results);
}catch(Exception ex)
{

}
}
}

 

If i instead use ODBC connection (and changing all int? and short? to decimal? in the created models) will work it seems like. but if i try use that same odbc connection when i convert the datawindows, snapdevelop crashes. Im using snapdevelop 2019 R2.

Comment
There are no comments made yet.
David Xiong @Appeon Accepted Answer Pending Moderation
  1. Tuesday, 22 June 2021 10:21 AM UTC
  2. .NET DataStore
  3. # 2

Hi Per, 

Currently, SnapObjects support decimal data type of up to 28 digit precision. But it doesn’t support OracleDecimal. When using SnapObjects, it doesn’t support manually changing the data type from decimal to OracleDecimal for the model in SnapDevelop. What precision do you need in your case? We suggest that you submit an enhancement request through our ticket system (https://www.appeon.com/standardsupport/newbug).

BTW, SnapDevelop R2 doesn’t support connecting to Oracle using ODBC. Please choose “Oracle” for “Database provider” on the Database Connection window for connection to Oracle. See the screenshot below.

Regards,

David

 

Comment
There are no comments made yet.
Per Ahlander Accepted Answer Pending Moderation
  1. Wednesday, 23 June 2021 06:04 AM UTC
  2. .NET DataStore
  3. # 3

Mabye let me rephrase it. We are prefectly fine with 28 digits precision the problem really is that it crashes when trying to map oracles large numbers. We have alot of datawindows in our desktop  application that we would like to convert to webapi but we cant be rounding every oracle number in every datawindow just to be safe. (i know even if snapdevelop didnt support oracle odbc , the decimal numbers never crashed atleast).

Comment
  1. Armeen Mazda @Appeon
  2. Wednesday, 23 June 2021 06:42 AM UTC
You cannot use ODBC. Is it crashing with the native Oracle data provider?
  1. Helpful
There are no comments made yet.
Per Ahlander Accepted Answer Pending Moderation
  1. Wednesday, 23 June 2021 08:51 AM UTC
  2. .NET DataStore
  3. # 4

https://github.com/pellejobb that project gives the same error. remove one digit from the sql on the model and it works. 

Comment
  1. Per Ahlander
  2. Monday, 28 June 2021 11:13 AM UTC
I have also checked how entityframework handles this, and it works just fine. no exceptions if there is too many digits for a c# decimal.
  1. Helpful
There are no comments made yet.
  • Page :
  • 1


There are no replies made for this question yet.
However, you are not allowed to reply to this question.