PC Review


Reply
Thread Tools Rate Thread

Call a stored procedure with decimal parameter

 
 
Mona
Guest
Posts: n/a
 
      27th Jun 2003
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



 
Reply With Quote
 
 
 
 
Steve Miller
Guest
Posts: n/a
 
      27th Jun 2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
Rajesh Tiwari
Guest
Posts: n/a
 
      27th Jun 2003
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" <(E-Mail Removed)> wrote in message
news:(E-Mail Removed)...
> 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
>
>
>



 
Reply With Quote
 
 
 
Reply

Thread Tools
Rate This Thread
Rate This Thread:

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
OleDb SqlDataSource stored procedure call parameter order mixed up ? User Microsoft ASP .NET 0 30th Sep 2010 05:20 AM
Call SQL stored procedure that inserts parameter value sck10 Microsoft Access VBA Modules 0 13th Nov 2008 05:15 PM
Call stored procedure with table parameter Jeremy Microsoft ADO .NET 2 6th May 2008 08:22 PM
stored procedure decimal parameter syntax Tom Loach Microsoft ADO .NET 0 5th Aug 2003 08:53 PM
Called a Stored Procedure , decimal parameter Mona Microsoft ASP .NET 1 27th Jun 2003 03:08 PM


Features
 

Advertising
 

Newsgroups
 


All times are GMT +1. The time now is 05:09 PM.