Adam Rackis
Adam Rackis

Reputation: 83358

Entity Framework Rounding

One of my entity objects (EF4) has a property that is a decimal. The field in the database is Decimal(18,2)

If I set the value to 30.4777 it only sends 30.47 over to the db in the insert statement (as confirmed by the tracer). Is there a way to get it to send 30.4777 and then just let the database round it off (which it seems happy to otherwise do)?

Upvotes: 4

Views: 2397

Answers (1)

Yakimych
Yakimych

Reputation: 17752

You can set the Precision and Scale properties of your decimal field yourself. Just right-click the property in the designer, and choose Properties. In the properties window you will find Precision and Scale. Set Scale to 4 and try your queries again.

Upvotes: 2

Related Questions