473,803 Members | 4,392 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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

Nov 17 '05 #1
1 2114
You might want to use CDec instead of CDbl.

Tu-Thach
-----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 specified.
Dim p1 As SqlParameter = .Parameters.Add ("@EstConstruct ionCost_10",System.Data.Sq lDbType.Decimal , 9).Value = CDbl (txtEstConstruc tionCost.Text)
' Dim p1 As SqlParameter = .Parameters.Add ("@EstConstruct ionCost_10",System.Data.Sq lDbType.Decimal ).Value = 10

p1.Precision = 10

p1.Scale = 0
I appreciate any help

.

Nov 17 '05 #2

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

Similar topics

0
6707
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...
4
8102
by: MD | last post by:
I am trying to create a dynamic SQL statement to create a view. I have a stored procedure, which based on the parameters passed calls different stored procedures. Each of this sub stored procedure creates a string of custom SQL statement and returns this string back to the main stored procedure. This SQL statements work fine on there own. The SQL returned from the sub stored procedure are returned fine. The datatype of the variable that...
4
1814
by: erich93063 | last post by:
I have a stored procedure which is performing a search against a "task" table. I would like to pass in a variable called @strAssignedTo which will be a comma delimeted list of employee ID's ie: "5,6,10". So my SQL without this variable would be something like: WHERE intAssignedTo IN (5,6,10) but when I try to do: WHERE intAssignedTo IN (@strAssignedTo)
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...
2
10092
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",...
22
4292
by: M K | last post by:
Heres my SP: ( i am trying to add more than 1 field but get the same error no matter how many i try to add, i thought i would try to insert the primary key only and work up from there but the primary key insert didnt work either. I can run the SP manually in Visual Studio .NET and it works. When i try to do this it doesn't. Any help is greatly appreciated... newbie here as well so please be gentle :) ALTER PROCEDURE dbo.AddJob
2
10586
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
9562
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
10542
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
10309
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...
1
10289
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10068
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
5496
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
5625
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4274
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3795
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.