Solved

ADODB.Command error '800a0d5d'

Posted on 2011-09-07
15
1,394 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
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
Visualize your virtual and backup environments

Create well-organized and polished visualizations of your virtual and backup environments when planning VMware vSphere, Microsoft Hyper-V or Veeam deployments. It helps you to gain better visibility and valuable business insights.

 

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 Comment

by:garethtnash
ID: 36495274
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

Salesforce Made Easy to Use

On-screen guidance at the moment of need enables you & your employees to focus on the core, you can now boost your adoption rates swiftly and simply with one easy tool.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
sql query help 15 55
ASP and Looping Thru a XML Document 4 32
Convert this script to work with Windows 10 ftp 36 71
T-SQL: I need to add an index on a field 5 27
In this article I will describe the Backup & Restore 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.
When you see single cell contains number and text, and you have to get any date out of it seems like cracking our heads.
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…
Exchange organizations may use the Journaling Agent of the Transport Service to archive messages going through Exchange. However, if the Transport Service is integrated with some email content management application (such as an antispam), the admini…

733 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