skip to Main Content

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…

SQL Table Information

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


  1. You can use bigint type. int, bigint, smallint, and tinyint

    bigint

     range: -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807
    
    Login or Signup to reply.
  2. 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 decimal
    like this 1112223334445.12

    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search