The precision is invalid

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Scott

    The precision is invalid

    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.Paramete rs.Append (cmdpay.CreateP arameter("@Amou nt", adDecimal,
    adParamInput,15 , Request.Form("t xtPaymentAmount "))).


    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.


  • Bob Barrows [MVP]

    #2
    Re: The precision is invalid

    Scott wrote:[color=blue]
    > 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.Paramete rs.Append (cmdpay.CreateP arameter("@Amou nt", adDecimal,
    > adParamInput,15 , Request.Form("t xtPaymentAmount "))).
    >
    >
    > 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.[/color]

    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:



    HTH,
    Bob Barrows

    --
    Microsoft MVP -- ASP/ASP.NET
    Please reply to the newsgroup. The email account listed in my From
    header is my spam trap, so I don't check it very often. You will get a
    quicker response by posting to the newsgroup.


    Comment

    • [MSFT]

      #3
      RE: The precision is invalid

      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.Creat eParameter("@Am ount", adDecimal, adParamInput,15 ,
      Request.Form("t xtPaymentAmount "))

      p1.NumericScale =5

      p1.Precision=10

      cmdpay.Paramete rs.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.)



      Comment

      Working...