Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6579527
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T15:54:35+00:00 2026-05-25T15:54:35+00:00

I have a textbox which is restricted to decimal input but the sql table

  • 0

I have a textbox which is restricted to decimal input but the sql table has restriction on the column that it is Decimal(18,2). So the error is people are able to enter more than 18 digits + as many as digits after decimal but if i still do a

 Math.Round(decimal,intDigits);

then the digits before the decimal will exceed 18 and will shoot me an error. So the question is how to Round a decimal with this restrictions.Decimal(18,2).

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T15:54:35+00:00Added an answer on May 25, 2026 at 3:54 pm

    For the SQL Decimal(p,q) data type, p specifies the total precision (number of decimal digits), and q specifies the scale (number of digits to the right of the decimal point). In you case (decimal(18,2)), you’ve got 18 decimal digits, the rightmost 2 of which are to the right of the decimal point.

    What you need to to is put validation constraints on your text box. You can

    • use a regular expression to do the validation. The regular expression ^-?\d{1,16}(\.\d{1,2})?$ would do the trick. Omit the optional minus sign if you don’t want them to be able to enter negative numbers.

    • you could validate against a range: convert to Decimal, then check to see if it is within the valid range of values.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a textbox which has the code; <input type=text maxlength=5 size=2 value=1 id=paging_textbox>
I have some C# / asp.net code I inherited which has a textbox which
I have a user control which has a textbox on it, now this usercontrol
I have a textbox which is displaying the field Address2. If Address2 has a
I have a javascript restricted calendar on a textbox, which prevents the user from
I am using C#.Net. I have textbox which allow only number, decimal and percentage(%)
I have a textbox which is read-only. It is used to take input of
I have a textbox which I want to set the focus on, but it
I have a textbox which has JQuery UI DatePicker control registered to it. It
I have one textbox which has the following text. TextBox1.Text = The above materials

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.