Solved

ADODB.Command error '800a0d5d'

Posted on 2011-09-07
15
1,300 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 30

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
 

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
PRTG Network Monitor: Intuitive Network Monitoring

Network Monitoring is essential to ensure that computer systems and network devices are running. Use PRTG to monitor LANs, servers, websites, applications and devices, bandwidth, virtual environments, remote systems, IoT, and many more. PRTG is easy to set up & use.

 
LVL 30

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

Zoho SalesIQ

Hassle-free live chat software re-imagined for business growth. 2 users, always free.

Question has a verified solution.

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

Naughty Me. While I was changing the database name from DB1 to DB_PROD1 (yep it's not real database name ^v^), I changed the database name and notified my application fellows that I did it. They turn on the application, and everything is working. A …
Not long ago I saw a question in the VB Script forum that I thought would not take much time. You can read that question (Question ID  (http://www.experts-exchange.com/Programming/Languages/Visual_Basic/VB_Script/Q_28455246.html)28455246) Here (http…
Internet Business Fax to Email Made Easy - With eFax Corporate (http://www.enterprise.efax.com), you'll receive a dedicated online fax number, which is used the same way as a typical analog fax number. You'll receive secure faxes in your email, fr…
Video by: Mark
This lesson goes over how to construct ordered and unordered lists and how to create hyperlinks.

861 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

25 Experts available now in Live!

Get 1:1 Help Now