The value of the parameter "163753323027.987000000" is out of range
I am getting the following exception when trying to save a value to db via EntityFramework
InnerException: An error occurred while updating the entries. See the inner exception for details.
InnerException -> InnerException: Parameter value '163753323027.987000000' is out of range.
I tried all the solutions provided. But still it was not possible to solve the problem. I am using EntityFramework, SQL Server. This is not the first code.
My table has a column
ActualHydPressureDropPipe decimal(30, 10)
The db app stores the value 163753323027.987000000
I can't try the one provided here here because I don't have an EntityTypeConfiguration class.
I tried to answer here
protected override void OnModelCreating(DbModelBuilder modelBuilder)
{
modelBuilder.Entity<Mud_Volumes>().Property(x => x.ActualHydPressureDropPipe).HasPrecision(30, 10);
base.OnModelCreating(modelBuilder);
}
This doesn't work either. I am not sure why the control is not included in the above method. Maybe because this is not the first code.
I checked in my edmx, I have
<Property Type="Decimal" Name="ActualHydPressureDropPipe" Nullable="false" Precision="30" Scale="10" />
Please advice.
source to share
I had a similar problem. When writing to decimal (18.0), my error message is: The value of the parameter '0.7880523731587561374795417349' is out of range.
I tried the solution above by restarting VS but no luck. However, adding rounding solved my problem:
Math.Round((0.7880523731587561374795417349m), 4)
Funny how it worked, even the actual decimal (18,0) doesn't store any digit after the decimal point. It must be decimal (18.4) to keep the shape rounded.
source to share