Called a Stored Procedure , decimal parameter

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

    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.

    Dim p1 As SqlParameter = .Parameters.Add ("@EstConstruct ionCost_10",
    System.Data.Sql DbType.Decimal, 9).Value = CDbl(txtEstCons tructionCost.Te xt)

    ' Dim p1 As SqlParameter = .Parameters.Add ("@EstConstruct ionCost_10",
    System.Data.Sql DbType.Decimal) .Value = 10

    p1.Precision = 10

    p1.Scale = 0
    I appreciate any help





  • Tu-Thach

    #2
    Called a Stored Procedure , decimal parameter

    You might want to use CDec instead of CDbl.

    Tu-Thach
    [color=blue]
    >-----Original Message-----
    >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[/color]
    specified.[color=blue]
    >
    >Dim p1 As SqlParameter = .Parameters.Add[/color]
    ("@EstConstruct ionCost_10",[color=blue]
    >System.Data.Sq lDbType.Decimal , 9).Value = CDbl[/color]
    (txtEstConstruc tionCost.Text)[color=blue]
    >
    >' Dim p1 As SqlParameter = .Parameters.Add[/color]
    ("@EstConstruct ionCost_10",[color=blue]
    >System.Data.Sq lDbType.Decimal ).Value = 10
    >
    >p1.Precision = 10
    >
    >p1.Scale = 0
    >I appreciate any help
    >
    >
    >
    >
    >
    >.
    >[/color]

    Comment

    Working...