Welcome to Dream.In.Code
Getting VB.NET Help is Easy!

Join 136,278 VB.NET Programmers for FREE! Get instant access to thousands of VB.NET experts, tutorials, code snippets, and more! There are 2,274 people online right now. Registration is fast and FREE... Join Now!




SQL 2005 Decimal Parameter Type

 
Reply to this topicStart new topic

SQL 2005 Decimal Parameter Type

Tim A
13 Oct, 2008 - 02:56 PM
Post #1

New D.I.C Head
*

Joined: 3 Apr, 2008
Posts: 17

I have a double value that I'm trying to pass to a SQL 2005 Stored Procedure.

I pass it as follows:

SQLCommand.Parameters.Append .CreateParameter("@Offset", adDecimal, adParamInput, , CalibrationEEPROM(Unit).offset)
SQLCommand.Parameters("@Offset").Precision = 7
SQLCommand.Parameters("@Offset").NumericScale = 6


When I do a trace on the SQL Server, the value looks like it was converted to an integer, i.e. 0.0005 becomes 5 when passed to the server.

Any ideas on how to get it to pass it over correctly as a decimal?
User is offlineProfile CardPM
+Quote Post

PsychoCoder
RE: SQL 2005 Decimal Parameter Type
13 Oct, 2008 - 04:22 PM
Post #2

using DIC.Core;
Group Icon

Joined: 26 Jul, 2007
Posts: 8,983



Thanked: 125 times
Dream Kudos: 8625
Expert In: VB, VB.Net, C#, SQL, ASP, ASP.Net, Web Development, HTML, CSS, Win32 API, Javascript, mySQL, J#, Boo.Net

My Contributions
First, this is VB.NET code that you posted so Im moving this to the VB.NET forum, second, what data type is the stored procedure expecting?
User is offlineProfile CardPM
+Quote Post

Tim A
RE: SQL 2005 Decimal Parameter Type
13 Oct, 2008 - 08:36 PM
Post #3

New D.I.C Head
*

Joined: 3 Apr, 2008
Posts: 17

First, this is VB6 code.
Second, I misunderstood the parameters. I assumed that the Precision and NumericScale corresponded to the Precision and NumericScale in the SQL 2005 Decimal() type. The only remaining question I have is do I have to format my Double when I pass it to the SQL Stored Procedure or can I just assign it as-is and let the SQL Store Procedure handle any conversion...
User is offlineProfile CardPM
+Quote Post

Fast ReplyReply to this topicStart new topic
Time is now: 12/2/08 05:21AM

Live VB.NET Help!

VB.NET Tutorials

Reference Sheets

VB.NET Snippets

DIC Chatroom

Bye Bye Ads

Monthly Drawing

Thumb Drive

Top Contributors

Top 10 Kudos This Month