473,831 Members | 2,308 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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 ("@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

Nov 17 '05 #1
2 10094
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" <ma****@yahoo.c om> wrote in message
news:ee******** ******@tk2msftn gp13.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 ("@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

Nov 17 '05 #2
the problem seems to be in statement
CDbl(txtEstCons tructionCost.Te xt)

it should be CDbl(txtEstCons tructionCost.Te xt.ToString())
or try
double.parse(tx tEstConstructio nCost.Text)

hope this helps
--
Rajesh Tiwari

"Mona" <ma****@yahoo.c om> wrote in message
news:ee******** ******@tk2msftn gp13.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 ("@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

Nov 17 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
6708
by: Nashat Wanly | last post by:
HOW TO: Call a Parameterized Stored Procedure by Using ADO.NET and Visual C# .NET View products that this article applies to. This article was previously published under Q310070 For a Microsoft Visual Basic .NET version of this article, see 308049. For a Microsoft Visual C++ .NET version of this article, see 310071. For a Microsoft Visual J# .NET version of this article, see 320627. This article refers to the following Microsoft .NET...
3
2868
by: N. Shamsundar | last post by:
A stored procedure (listed below) that loads fine on Windows XP with DB2 V8.1.4 Express fails to load on Linux DB2 Workgroup server V8.1, with the following message: > sh-2.05a$ db2 -td@ -f pgpa.db2 > DB21034E The command was processed as an SQL statement because it was not a > valid Command Line Processor command. During SQL processing it returned: > SQL0035N The file "P2340425.msg" cannot be opened. What does this message mean?...
1
962
by: Johnny | last post by:
I have a stored procedure that takes three input parameters and returns a single record result set. The stored procedure is declare as follows: p_getTaxAmount (@ZipCodeDtlId uniqueidentifier, @CategoryID uniqueidentifier, @SalesAmount decimal(17,8)) I have a windows form where the user enters the zip code, category, and sales amount. I need to know how to capture the value in the sales amount text box and send it as a parameter to...
1
2116
by: Mona | last post by:
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
1
1011
by: Kev | last post by:
Can anyone help me determine why I am getting the error "Object must implement IConvertible" when I execute the stored procedure? The exception is InvalidCastException. Below is the code. I have checked the stored procedure, database table column datatype and the sqldbtype and they are identical. The only thing that is not the same is the datatype of the @col1 and @col2 parameter in the server explorer where it is shown as "adnumeric",...
6
2321
by: Sam | last post by:
I had created stored procedure at SQL Server 2000 and how do I call it via ASP.Net using VB Language? CREATE PROCEDURE STK As if exists (select * from dbo.sysobjects where id = object_id(N'.') and OBJECTPROPERTY(id, N'IsUserTable') = 1) drop table . GO
4
4998
by: Pakna | last post by:
Hi, is there any way to call a JAVA stored procedure from a SQL Trigger? We are having difficulties with this and cannot verify whether DB2 even *has* this capability? Thank you very much....
3
4210
by: .Net Sports | last post by:
I need to call an stored procedure from an asp script, I don't need to do an Output parameter, only input parameters on 3 vars, but I get a "BOF EOF not true or record has been deleted" error when trying to call the page with the correct querystrings. The stored procedure looks like it's properly called , as i tried misspelling the stored procedure in the "CmdSP.CommandText = "resultsSP" " line, and the error prompted no such stored...
2
10596
by: savio XCIX | last post by:
I created the following stored procedure: ======= CREATE PROCEDURE TBLNAME.proc_test (IN p_custnum VARCHAR(8), IN p_zipcode CHAR(5), OUT r_valid CHAR(1), OUT r_bal DECIMAL(9,2)) LANGUAGE SQL BEGIN
0
9642
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10778
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10496
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
10210
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9319
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7750
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5622
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5788
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
3967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.