The precision is invalid

S

Scott

Hello all - I could use a little CreateParameter help - I am trying to pass
parameter to a stored procedure on a SQL Server 2000 DB and one of the
columns I think I am having a problem with is a float data type.
Right now my append statement looks like this:
cmdpay.Parameters.Append (cmdpay.CreateParameter("@Amount", adDecimal,
adParamInput,15, Request.Form("txtPaymentAmount"))).


When I execute the stored proc, it returns a precision is invalid error, but
I cannot find a adFloat parameter sample anywhere - am I missing something
here? Any help would be greatly appreciated. I asked our DBA to make the
data type for the column a decimal, but NOOOOO he wants it to be a float
instead.

thanks.
 
B

Bob Barrows [MVP]

Scott said:
Hello all - I could use a little CreateParameter help - I am trying
to pass parameter to a stored procedure on a SQL Server 2000 DB and
one of the columns I think I am having a problem with is a float data
type.
Right now my append statement looks like this:
cmdpay.Parameters.Append (cmdpay.CreateParameter("@Amount", adDecimal,
adParamInput,15, Request.Form("txtPaymentAmount"))).


When I execute the stored proc, it returns a precision is invalid
error, but I cannot find a adFloat parameter sample anywhere - am I
missing something here? Any help would be greatly appreciated. I
asked our DBA to make the data type for the column a decimal, but
NOOOOO he wants it to be a float instead.

thanks.

You have to set the Precision and NumericScale properties after the
Parameter object is created.

You would probably benefit from my free stored procedure code generator
which is available here:

http://www.thrasherwebdesign.com/index.asp?pi=links&hp=links.asp

HTH,
Bob Barrows
 
M

[MSFT]

Hi Scott,

In method CreateParameter, if you specify a numeric data type (adNumeric or
adDecimal) in the Type argument, then you must also set the NumericScale
and Precision properties.For example:

dim p1

set p1=cmdpay.CreateParameter("@Amount", adDecimal, adParamInput,15,
Request.Form("txtPaymentAmount"))

p1.NumericScale=5

p1.Precision=10

cmdpay.Parameters.Append p1

Hope this help,

Luke
Microsoft Online Support

Get Secure! www.microsoft.com/security
(This posting is provided "AS IS", with no warranties, and confers no
rights.)
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
474,146
Messages
2,570,832
Members
47,374
Latest member
anuragag27

Latest Threads

Top