I'm having a problem inserting a decimal value into the database using PetaPoco.
In my model I have the proeprty:
[Column("Price")]
public decimal PriceTotal { get; set; }
and in the databse the relevant column Price
is of type decimal(18, 2)
When I do the insert:
public void InsertModel(MyViewModel model)
{
_database.Insert(model);
}
I'm getting an error:
System.InvalidCastException: 'Invalid cast from 'System.Decimal' to 'System.Nullable`1[[System.Int32, mscorlib, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089]]'.'
Not sure how else I could do that? doesn't decimal
translate to sql server's decimal(18,2)
?