?
Solved

ADODB.Command error '800a0d5d'

Posted on 2011-09-07
15
Medium Priority
?
1,495 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
Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 

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 2000 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

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

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.
Ever needed a SQL 2008 Database replicated/mirrored/log shipped on another server but you can't take the downtime inflicted by initial snapshot or disconnect while T-logs are restored or mirror applied? You can use SQL Server Initialize from Backup…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
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…

771 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