I am inserting a simple object into a database, using Linq2Sql (yes, yes, I will change to EF someday soon).
This object has a decimal value. When I debug, I can see the value of price is 6.8 .
However, when I insert into the database, the value is 7. The datatype of the field is decimal(18, 0)
.
If it helps, I think it mgiht be because I am on a Danish computer, and the rounding char is "," and not ".".
My inserting code:
var order = new PlacedOrder()
{
DateCreated = DateTime.Now,
UserId = userid,
PaymentInfo = paymentInfoId,
ShippingInfo = shippingInfoId,
OrderState =orderState.ToString(),
PaymentMethod = paymentMethod.ToString(),
Email = email,
Phone = phone,
PdfFilePath = pdfPath,
Price = price,
PriceVat = vat
};
db.PlacedOrders.InsertOnSubmit(order);
db.SubmitChanges();
Any ideas?