Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

0x80004005: The precision is invalid.

7 views
Skip to first unread message

DJP

unread,
Oct 8, 2003, 3:19:49 PM10/8/03
to
Hi,
I am Tring to send a decimal to a SQL stored Procedure and get a The
precision is invalid.

The Fields are set for 4 precision 2 scale decimal

@HOURHoliday [decimal](4,2),
@HOURSOT [decimal](4,2),
@HOURSREG [decimal](4,2),
@HOURSVAC [decimal](4,2),

The ado code area is

P.Append CN.CreateParameter("@HOURHoliday",adDecimal,1,4)
P.Append CN.CreateParameter("@HOURSOT",adDecimal,1,4)
P.Append CN.CreateParameter("@HOURSREG",adDecimal,1,4)
P.Append CN.CreateParameter("@HOURSVAC",adDecimal,1,4)

this code also result in the same error
P.Append CN.CreateParameter("@HOURHoliday",adDecimal,1)
P.Append CN.CreateParameter("@HOURSOT",adDecimal,1)
P.Append CN.CreateParameter("@HOURSREG",adDecimal,1)
P.Append CN.CreateParameter("@HOURSVAC",adDecimal,1)

this is where the paramater are set
CN("@HOURHoliday") = HolidayHours
CN("@HOURSOT") = OverTimeHours
CN("@HOURSREG") = RegularHours
CN("@HOURSVAC") = VacationHours

I am sure there is a problem between the stored proc and the ado pramater.
basic value I would send to all is like 10.75

D


Bob Barrows

unread,
Oct 8, 2003, 3:38:15 PM10/8/03
to
You cannot set the precision and scale properties in the CreateParameter
method. Those Parameter properties need to be set after the Parameter is
completed. You may want to try my Stored Procedure Code generator. It is
available here:
http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp

HTH,
Bob Barrows

falkner

unread,
Aug 26, 2009, 4:52:59 PM8/26/09
to
e.g.
cmd.Parameters.Append _
cmd.CreateParameter("@DRate", adDecimal, adParamInput, 18, CommissionRate)
cmd.Parameters("@DRate").Precision = 2

From http://www.developmentnow.com/g/61_2003_10_0_0_255409/0x80004005-The-precision-is-invalid-.htm

Posted via DevelopmentNow.com Groups
http://www.developmentnow.com/g/

Bob Barrows

unread,
Aug 26, 2009, 5:19:21 PM8/26/09
to
falkner wrote:
> e.g.
> cmd.Parameters.Append _
> cmd.CreateParameter("@DRate", adDecimal, adParamInput, 18,
> CommissionRate) cmd.Parameters("@DRate").Precision = 2
>
> From
>
http://www.developmentnow.com/g/61_2003_10_0_0_255409/0x80004005-The-precision-is-invalid-.htm
>

Is this an answer or a question?

If a question, I would guess that the precision is too small for the
data being passed via CommissionRate.

Precision = total number of digits including decimal places
NumericScale = number of decimal digits

So a decimal(3,1) parameter would allow values between -99.9 and 99.9

Also, the address for my stored procedure code generator is now:
http://common.mvps.org/barrowsb/ClassicASP_sp_code_generator.zip
--
HTH,
Bob Barrows


0 new messages