Decimal Data Type for Command Object Paramenter

Posted on 2003-03-02
Medium Priority
Last Modified: 2012-08-14
Hello friends,

I'm using the command object to insert and update info to a SQL Server database.  I need to have a decimal on one of my parameters, and I'm encountering this problem:

"The precision is invalid."

Here's my parameter:

.Parameters.Append = .CreateParameter("@TotalHoursWorked",                    adDecimal,     adParamInput,       9,     Request.Form("txtTotalHoursWorked"))

My stored procedure declaration is:

@TotalHoursWorked                       decimal(9,2)     = NULL

I've never tried this before so I'm could really use any help you good folks can lend.

Thank you so much, friends.

Jazon Samillano
University of North Florida
Question by:piratepatrol
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
  • 2

Expert Comment

ID: 8055251
if ur using asp then try converting to double i.e

.Parameters.Append = .CreateParameter "@TotalHoursWorked", adDecimal, adParamInput, 9, CDbl(Request.Form ("txtTotalHoursWorked"))))


Author Comment

ID: 8055432
Hi umeshmohite - I tried it, and I get the same problem.  Any other suggestions?  Thanks in advance.

Accepted Solution

umeshmohite earned 200 total points
ID: 8055942
try using CDec(Request.Form ("txtTotalHoursWorked"))
if it won't work then increase the size of the input parameter b'coz i thing the number i.e coimg from Request.Form ("txtTotalHoursWorked") is greater than size 9.

Author Comment

ID: 8060981
Now I get

"Variable is undefined: 'CDec'"

Request.Form ("txtTotalHoursWorked") = "11" in this form.  

Wow, this is a hassle.  Any other suggestions, my friend?

Featured Post

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

When crafting your “Why Us” page, there are a plethora of pitfalls to avoid. Follow these five tips, and you’ll be well on your way to creating an effective page.
This article was originally published on Monitis Blog, you can check it here . Today it’s fairly well known that high-performing websites and applications bring in more visitors, higher SEO, and ultimately more sales. By the same token, downtime…
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Any person in technology especially those working for big companies should at least know about the basics of web accessibility. Believe it or not there are even laws in place that require businesses to provide such means for the disabled and aging p…
Suggested Courses

801 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question