Solved

ADODB.Command error '800a0d5d'

Posted on 2011-09-07
15
1,269 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
  • 8
  • 5
  • 2
15 Comments
 
LVL 10

Expert Comment

by:OnALearningCurve
Comment Utility
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 30

Expert Comment

by:Wayne Barron
Comment Utility
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
Comment Utility
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
 

Author Comment

by:garethtnash
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
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
How your wiki can always stay up-to-date

Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
- Increase transparency
- Onboard new hires faster
- Access from mobile/offline

 
LVL 30

Expert Comment

by:Wayne Barron
Comment Utility
int are left blank

So, remove the #
0
 

Author Comment

by:garethtnash
Comment Utility
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
Comment Utility
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
Comment Utility
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
Comment Utility
I'll take a look,

Cheers,

Mark,
0
 

Author Comment

by:garethtnash
Comment Utility
0
 

Author Closing Comment

by:garethtnash
Comment Utility
Big Thanks
0
 
LVL 10

Expert Comment

by:OnALearningCurve
Comment Utility
Glad I could help.

Thanks for the points :)
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Occasionally there is a need to clean table columns, especially if you have inherited legacy data. There are obviously many ways to accomplish that, including elaborate UPDATE queries with anywhere from one to numerous REPLACE functions (even within…
In this article I will describe the Detach & Attach method as one possible migration process and I will add the extra tasks needed for an upgrade when and where is applied so it will cover all.
This video shows how to remove a single email address from the Outlook 2010 Auto Suggestion memory. NOTE: For Outlook 2016 and 2013 perform the exact same steps. Open a new email: Click the New email button in Outlook. Start typing the address: …
This tutorial demonstrates a quick way of adding group price to multiple Magento products.

744 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

Need Help in Real-Time?

Connect with top rated Experts

16 Experts available now in Live!

Get 1:1 Help Now