How to Create a Decimal-Type Command Parameter in ASP

Posted on 2004-11-03
Last Modified: 2011-09-20
Hi friends,

Can someone show me the right way to create decimal-type command parameterin ASP?  My code below give me a "precision is invalid" error.

Dim cmdClaimInsertUpdate
Set cmdClaimInsertUpdate = Server.CreateObject("ADODB.Command")
With cmdClaimInsertUpdate
      .ActiveConnection = cn
      .CommandText = "sp_ClaimInsertUpdate"
      .CommandType = adCmdStoredProc
      .Parameters.Append = .CreateParameter("@Claim_RepairLaborRate", adDecimal, adParamInput,  , Request.Form("txtClaimRepairLaborRate"))
End With
Set cmdClaimInsertUpdate = Nothing

In the sp_ClaimInsertUpdate stored procedure, I have the following declaration...

@Claim_RepairLaborRate      DECIMAL(18,2)      = NULL,

The field name Claim_RepairLaborRate is a decimal type with 18 precision and 2 scale.

Any help on this matter would be so greatly appreciated.

Thanks a bundle,

Jazon from Jacksonville, FL
Question by:piratepatrol
    LVL 13

    Accepted Solution

    LVL 13

    Expert Comment

    LVL 3

    Author Comment

    Actually, the following line solved my problem.

    .Parameters("@Claim_RepairLaborRate").Precision = 18

    Thank you for your response.
    LVL 13

    Expert Comment

    yes, but Decimal is 14 not 18
    LVL 3

    Author Comment

    What database are you using?  Mine is 18 by default.

    Featured Post

    Maximize Your Threat Intelligence Reporting

    Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

    Join & Write a Comment

    When pages do not download correctly, and you don't know why, the first thing you do is to look at the HTML source code of that page, but not all the downloaded files appear always clearly. If your source includes a javascript that computes the name…
    The Client Need Led Us to RSS I recently had an investment company ask me how they might notify their constituents about their newsworthy publications.  Probably you would think "Facebook" or "Twitter" but this is an interesting client.  Their cons…
    This tutorial walks through the best practices in adding a local business to Google Maps including how to properly search for duplicates, marker placement, and inputing business details. Login to your Google Account, then search for "Google Mapmaker…
    This video teaches users how to migrate an existing Wordpress website to a new domain.

    734 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

    Need Help in Real-Time?

    Connect with top rated Experts

    22 Experts available now in Live!

    Get 1:1 Help Now