Call a stored procedure with decimal parameter

Ask a Question related to ASP.NET General, Design and Development.

  1. #1

    Default Call a stored procedure with decimal parameter

    I have a stored procedure with a decimal parameter .

    how can send the decimal value?
    I try this but it gives an error , invalid cast specified.

    Dim p1 As SqlParameter = .Parameters.Add("@EstConstructionCost_10",
    System.Data.SqlDbType.Decimal, 9).Value = CDbl(txtEstConstructionCost.Text)

    ' Dim p1 As SqlParameter = .Parameters.Add("@EstConstructionCost_10",
    System.Data.SqlDbType.Decimal).Value = 10

    p1.Precision = 10

    p1.Scale = 0
    I appreciate any help



    Mona Guest

  2. Similar Questions and Discussions

    1. #40143 [Opn->Bgs]: how to get parameter values of stored procedure.?
      ID: 40143 Updated by: tony2001@php.net Reported By: hd4_all at yahoo dot co dot in -Status: Open +Status: ...
    2. #40143 [NEW]: how to get parameter values of stored procedure.?
      From: hd4_all at yahoo dot co dot in Operating system: windows 2000 prof. PHP version: 5.2.0 PHP Bug Type: MySQLi related...
    3. populate datagrid with stored procedure w/parameter
      All, I'm trying to populate a datagrid with a data adapter that uses a stored procedure with a parameter. I get the below error when I run my...
    4. Stored Procedure/Parameter problem
      I'm getting an error I don't understand.... Here's my Code: Dim dr As SqlDataReader Dim retVal As Boolean = False Dim MySQL as string =...
    5. Called a Stored Procedure , decimal parameter
      I have a stored procedure with a decimal parameter . how can send the decimal value? I try this but it gives an error , invalid cast specified. ...
  3. #2

    Default Re: Call a stored procedure with decimal parameter

    I've run into this a lot. The only successful way I've found to make it
    work is to make the parameter a varchar; and use the SQL convert function in
    the stored procedure.


    "Mona" <mayy82@yahoo.com> wrote in message
    news:eeji5TJPDHA.3768@tk2msftngp13.phx.gbl...
    > I have a stored procedure with a decimal parameter .
    >
    > how can send the decimal value?
    > I try this but it gives an error , invalid cast specified.
    >
    > Dim p1 As SqlParameter = .Parameters.Add("@EstConstructionCost_10",
    > System.Data.SqlDbType.Decimal, 9).Value =
    CDbl(txtEstConstructionCost.Text)
    >
    > ' Dim p1 As SqlParameter = .Parameters.Add("@EstConstructionCost_10",
    > System.Data.SqlDbType.Decimal).Value = 10
    >
    > p1.Precision = 10
    >
    > p1.Scale = 0
    > I appreciate any help
    >
    >
    >

    Steve Miller Guest

  4. #3

    Default Re: Call a stored procedure with decimal parameter

    the problem seems to be in statement
    CDbl(txtEstConstructionCost.Text)

    it should be CDbl(txtEstConstructionCost.Text.ToString())
    or try
    double.parse(txtEstConstructionCost.Text)

    hope this helps


    --
    Rajesh Tiwari

    "Mona" <mayy82@yahoo.com> wrote in message
    news:eeji5TJPDHA.3768@tk2msftngp13.phx.gbl...
    > I have a stored procedure with a decimal parameter .
    >
    > how can send the decimal value?
    > I try this but it gives an error , invalid cast specified.
    >
    > Dim p1 As SqlParameter = .Parameters.Add("@EstConstructionCost_10",
    > System.Data.SqlDbType.Decimal, 9).Value =
    CDbl(txtEstConstructionCost.Text)
    >
    > ' Dim p1 As SqlParameter = .Parameters.Add("@EstConstructionCost_10",
    > System.Data.SqlDbType.Decimal).Value = 10
    >
    > p1.Precision = 10
    >
    > p1.Scale = 0
    > I appreciate any help
    >
    >
    >

    Rajesh Tiwari Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139