Solved

Application uses a value of the wrong type for the current operation.

Posted on 2008-06-16
7
1,733 Views
Last Modified: 2010-04-21
Hello,
I am filtering a sql server 2005 db by date. it works in one way but i also want it to work with dreamweavers default recordset creation. I attach 2 snippets, the top one works but the bottom one snippet 2 gives me the following error.


ADODB.Command error '800a0d5d'

Application uses a value of the wrong type for the current operation.

/aa.asp, line 19


any help grately received.

k
snippet 1 working
 
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
 
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_connpeepeek_STRING
Recordset1_cmd.CommandText = "SELECT usr_image1, dateimage_usr FROM diddle.ps_usr_image WHERE dateimage_usr >= DATEADD(dd,DATEDIFF(d,0,GETDATE()),0)" 
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 135, 1, -1, Recordset1__MMColParam) ' adDBTimeStamp
 
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>
 
 
 
 
 
 
--~~--~~--~~--~~--~~--~~--~~--~~--~~
snippet 2 is below
this is the line 19 given the erro
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 135, 1, -1, Recordset1__MMColParam) ' adDBTimeStamp
--~~--~~--~~--~~--~~--~~--~~--~~--~~
 
<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "DATEADD(dd,DATEDIFF(d,0,GETDATE()),0)" 
If (Request("MM_EmptyValue") <> "") Then 
  Recordset1__MMColParam = Request("MM_EmptyValue")
End If
%>
<%
Dim Recordset1
Dim Recordset1_cmd
Dim Recordset1_numRows
 
Set Recordset1_cmd = Server.CreateObject ("ADODB.Command")
Recordset1_cmd.ActiveConnection = MM_connpeepeek_STRING
Recordset1_cmd.CommandText = "SELECT usr_image1, dateimage_usr FROM diddle.ps_usr_image WHERE dateimage_usr >= ?" 
Recordset1_cmd.Prepared = true
Recordset1_cmd.Parameters.Append Recordset1_cmd.CreateParameter("param1", 135, 1, -1, Recordset1__MMColParam) ' adDBTimeStamp
 
Set Recordset1 = Recordset1_cmd.Execute
Recordset1_numRows = 0
%>

Open in new window

0
Comment
Question by:thatelvis
  • 3
  • 3
7 Comments
 
LVL 13

Expert Comment

by:jmundsack
ID: 21792680
In line 19 you have -1 as the "size" argument.  I think that's the problem.
0
 
LVL 1

Author Comment

by:thatelvis
ID: 21792687
but there is only 1 argument what should i have instead of the 1.

regards

k
0
 
LVL 22

Expert Comment

by:neeraj523
ID: 21793172
Hello

Try this


<%
Dim Recordset1__MMColParam
Recordset1__MMColParam = "DATEADD(dd,DATEDIFF(d,0,GETDATE()),0)" 
If isDate(Request("MM_EmptyValue")) Then 
  Recordset1__MMColParam = Request("MM_EmptyValue")
End If
%>

Open in new window

0
Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

 
LVL 1

Author Comment

by:thatelvis
ID: 21796214
Thanks neeta I tried that but get the following error

Application uses a value of the wrong type for the current operation.

cheets

k
0
 
LVL 22

Accepted Solution

by:
neeraj523 earned 500 total points
ID: 21799039
can you print the date value before execution and see what is the value
0
 
LVL 1

Author Closing Comment

by:thatelvis
ID: 31467558
the date value's were all squ if, thanks for your help.
0
 
LVL 22

Expert Comment

by:neeraj523
ID: 21862792
B Grade .. huh :)
0

Featured Post

Announcing the Most Valuable Experts of 2016

MVEs are more concerned with the satisfaction of those they help than with the considerable points they can earn. They are the types of people you feel privileged to call colleagues. Join us in honoring this amazing group of Experts.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JSON error 4 71
Error viewing ASP page 12 174
Select only the top record in a left join 13 45
If condition on Html with Asp 11 28
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
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…

860 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