Skip to main content
Participant
June 27, 2009
Question

New recordset in CS3 error using wildcard (ASP)

  • June 27, 2009
  • 2 replies
  • 837 views

I just tried Dreamweaver CS3. Looks like that it creates different recordset than in previous version.

When I create recordset and use % as default value to showw all records if parameter is missing I am getting error.

How to show all records if parameter is missing???

<%
Dim rute__MMColParam
rute__MMColParam = "%"
If (Request.QueryString("barki")   <> "") Then
  rute__MMColParam = Request.QueryString("barki") 
End If
%>
<%
Dim rute
Dim rute_cmd
Dim rute_numRows

Set rute_cmd = Server.CreateObject ("ADODB.Command")
rute_cmd.ActiveConnection = MM_conn_STRING
rute_cmd.CommandText = "SELECT * FROM dbo.calendar_Itin WHERE Bbrdd = ?"
rute_cmd.Prepared = true
rute_cmd.Parameters.Append rute_cmd.CreateParameter("param1", 5, 1, -1, rute__MMColParam) ' adDouble

Set rute = rute_cmd.Execute
rute_numRows = 0
%>

and I got this

ADODB.Command error '800a0d5d'

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

/adm/itineraries.asp, line 59

This topic has been closed for replies.

2 replies

Participating Frequently
June 28, 2009

Wildcards can only be used with the 'Like' predicate, not with '='.  To have the query return all results if the parameter is missing, put your If condition around the rute_cmd.CommandText. If the parameter is not null, use it in the where clause, otherwise don't include the where clause at all. More complex where clauses that may include multiple parameters can also be built in a similar fashion.

David_Powers
Inspiring
June 27, 2009

Thread moved to the appropriate forum: Dreamweaver Application Development.