Solved

ADODB.Command error '800a0d5d'

Posted on 2011-09-07
15
1,452 Views
Last Modified: 2012-05-12
Hello Experts, Help Please I'm getting the following error --

'ADODB.Command error '800a0d5d'
Application uses a value of the wrong type for the current operation.
/direct/includes/new-product-insert.asp, line 188'


Where Line 188 is;

CMDProductInsert.Parameters.Append CMDProductInsert.CreateParameter("@saletgiprice", 14, 1,10,CMDProductInsert__saletgiprice)

Open in new window


And CMDProductInsert__saletgiprice is defined as -

Dim CMDProductInsert__saletgiprice
CMDProductInsert__saletgiprice = "0.00"
if(UploadFormRequest("specialtgi") <> "") then CMDProductInsert__saletgiprice = Server.HTMLEncode(ProtectSQL(UploadFormRequest("specialtgi")))

Open in new window


The value I'm trying to insert in 10.00

FYI My database table is -

CREATE TABLE [dbo].[Direct-Product-Price](
	[ID] [int] IDENTITY(1,1) NOT NULL,
	[Product-ID] [int] NOT NULL,
	[Normal-Price] [decimal](10, 2) NOT NULL,
	[Special-Price] [decimal](10, 2) NOT NULL
) ON [PRIMARY]

GO

ALTER TABLE [dbo].[Direct-Product-Price] ADD  DEFAULT ('0.00') FOR [Normal-Price]
GO

ALTER TABLE [dbo].[Direct-Product-Price] ADD  DEFAULT ('0.00') FOR [Special-Price]
GO

Open in new window


AND the section of the SP doing the Insert into the table reads like -

insert into dbo.[Direct-Product-Price]([Product-ID],[Normal-Price], [Special-Price])
values(@productid, @normaltgiprice, @saletgiprice)

Open in new window


What am I missing??

Thank you
0
Comment
Question by:garethtnash
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 8
  • 5
  • 2
15 Comments
 
LVL 10

Expert Comment

by:OnALearningCurve
ID: 36494574
Hi garethtnash,
just a stab in the dark but is:


CMDProductInsert.Parameters.Append CMDProductInsert.CreateParameter("@saletgiprice", 14, 1,10,CMDProductInsert__saletgiprice)

Passing @saletgiprice as a string because it is wrapped in quotes?

Should the line be :

CMDProductInsert.Parameters.Append CMDProductInsert.CreateParameter(@saletgiprice, 14, 1,10,CMDProductInsert__saletgiprice)

instead?

hope this helps,

Mark.

0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 36494628
There are different issues that can happen here.

http://kb.cffcs.com/Main.asp?irid=11&Type=Article

Make sure that you are using the correct count ,14,

view the article above.

Carrzkiss
0
 

Author Comment

by:garethtnash
ID: 36494679
Hi Both,

Mark all of my parameters are in quotes, I did try removing but that caused other issues,..

Carrzkiss (Wayne) hello again :)

It's a decimal column with (10,2) so 10 should be sufficient? (I'm only sending the value 10.00)

Thanks

0
What Is Transaction Monitoring and who needs it?

Synthetic Transaction Monitoring that you need for the day to day, which ensures your business website keeps running optimally, and that there is no downtime to impact your customer experience.

 

Author Comment

by:garethtnash
ID: 36494734
I've just changed the default values from

Dim CMDProductInsert__saletgiprice
CMDProductInsert__saletgiprice = [b]"0.00"[/b]
if(UploadFormRequest("specialtgi") <> "") then CMDProductInsert__saletgiprice = Server.HTMLEncode(ProtectSQL(UploadFormRequest("specialtgi")))

Open in new window


to

Dim CMDProductInsert__saletgiprice
CMDProductInsert__saletgiprice = [b]0.00[/b]
if(UploadFormRequest("specialtgi") <> "") then CMDProductInsert__saletgiprice = Server.HTMLEncode(ProtectSQL(UploadFormRequest("specialtgi")))

Open in new window


In the last test I wasn't sending a value for the line above (decimal) I guess in which case it was trying to insert "0.00" into the column? Could that have been the issue, ANYWAY having made that change, bow I'm getting -

Microsoft OLE DB Provider for SQL Server error '80004005'
The precision is invalid.
/direct/includes/new-product-insert.asp, line 191


Where line 191 is

set Product = CMDProductInsert.Execute

line 190 is -

CMDProductInsert.Parameters.Append CMDProductInsert.CreateParameter("@saleproprice", 14, 1,10,CMDProductInsert__saleproprice)

Any suggestions please

Thank you
0
 

Author Comment

by:garethtnash
ID: 36494741
Ignore the BOLD Brackets in the code I was just trying to highlight the change that I hade made -- removing the "" from the default decimal values...

Thank you
0
 
LVL 10

Expert Comment

by:OnALearningCurve
ID: 36494753
Just as a sanity check can you write out the values you are passing to screen to see exactly what you are trying to write to the database (If you haven't already)

Cheers,

Mark.
0
 

Author Comment

by:garethtnash
ID: 36494830
Umm I think I might suspect what the issue is, alot of my columns are INTs

What is the maximum width for an INT? is it 8?

My code reads --

CMDProductInsert.Parameters.Append CMDProductInsert.CreateParameter("@stockcount", 3, 1,10,CMDProductInsert__stockcount)

where 10? is the length?

Could that be the issue?
0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 36494867
int are left blank

So, remove the #
0
 

Author Comment

by:garethtnash
ID: 36494995
HI Guys I found two of the errors, I was trying to put Y/N values into decimal columns, not very clever I admit... but that aside now I get the following --

Microsoft OLE DB Provider for SQL Server error '80004005'
The precision is invalid.
/direct/includes/new-product-insert-backup.asp, line 191 

Open in new window


Line 191 is

set Product = CMDProductInsert.Execute

Open in new window


As it is precision I'm guessing this has something to do with my decimal columns, which on the database are written as -

[Normal-Price] [decimal](10, 2) NOT NULL,

in my VBScript insert SP I'm using -

CMDProductInsert.Parameters.Append CMDProductInsert.CreateParameter("@normaltgiprice", 14, 1,10,CMDProductInsert__normaltgiprice)

'14,1,10'

Does that need to change?

Thank you
0
 
LVL 10

Accepted Solution

by:
OnALearningCurve earned 500 total points
ID: 36495085
What if you did not specify the length?

i.e.

14,1,0  (I think)

Or maybe set it as a double instead of a decimal

5,1,10
0
 

Author Comment

by:garethtnash
ID: 36495179
Thats fantastic thank you,

Unfortunatley that has resolved that problem, but has revealed 2more issues, Which I'm about to post again, as I think points need to be awarded here, Any chance I can get your help with these also?

Thank you

0
 
LVL 10

Expert Comment

by:OnALearningCurve
ID: 36495184
I'll take a look,

Cheers,

Mark,
0
 

Author Closing Comment

by:garethtnash
ID: 36495277
Big Thanks
0
 
LVL 10

Expert Comment

by:OnALearningCurve
ID: 36495419
Glad I could help.

Thanks for the points :)
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

SQL Server engine let you use a Windows account or a SQL Server account to connect to a SQL Server instance. This can be configured immediatly during the SQL Server installation or after in the Server Authentication section in the Server properties …
This article explains how to reset the password of the sa account on a Microsoft SQL Server.  The steps in this article work in SQL 2005, 2008, 2008 R2, 2012, 2014 and 2016.
Michael from AdRem Software outlines event notifications and Automatic Corrective Actions in network monitoring. Automatic Corrective Actions are scripts, which can automatically run upon discovery of a certain undesirable condition in your network.…
Michael from AdRem Software explains how to view the most utilized and worst performing nodes in your network, by accessing the Top Charts view in NetCrunch network monitor (https://www.adremsoft.com/). Top Charts is a view in which you can set seve…

717 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question