When I want to inset data, I got this error:
Parameter value ‘15000000000000000/00’ is out of range.
I searched the internet, and all answers are about datatype of table in SQL Server…
I’m sure I set it to more than ’15 digits’, and I still can’t insert number.
this is save method:
public void Save(CompanySupervisory companySupervisory)
{
try
{
Insert(companySupervisory);
SaveChange();
}
catch (Exception e)
{
throw new CustomException("error");
}
}
and viewModel class:
public long Id { get; set; }
public long CompanyId { get; set; }
public string CompanyTitle { get; set; }
public DateTime RegisterDate { get; set; }
public string RegisterDatePersian { get; set; }
public decimal SupervisoryCapital { get; set; }
Can anyone help me with this?
I’ve tried increasing Decimal datatype in SQL Server, and I’ve tried to find something about limitation in the code, but none of them worked for me.
2
Answers
You can use
bigint
type. int, bigint, smallint, and tinyintbigint
when we use decimal we should enter to number
DECIMAL(17,2)
first is maximum number digit and the second is for maximum decimal digit part
with
DECIMAL(17,2)
you can have 15 digit integer and 2 digit decimallike this
1112223334445.12