Home > Net >  .net EF decimal places when adding a decimal type data to be intercepted without rounding
.net EF decimal places when adding a decimal type data to be intercepted without rounding

Time:11-23

Database field of type: a decimal (18, 2)
When I use EF to add or modify data in the code assignment as follows: 1.259999999 saved in the database after the completion of execution is 1.25

CodePudding user response:

You can first rounded down to save the database processing

CodePudding user response:

Then you use Math. Round

CodePudding user response:

First round and then save

CodePudding user response:

Assignment of rounded bai directly
  •  Tags:  
  • C#
  • Related