Exit
  • Global community
    • Language:
      • Deutsch
      • English
      • Español
      • Français
      • Português
  • 日本語コミュニティ
    Dedicated community for Japanese speakers
  • 한국 커뮤니티
    Dedicated community for Korean speakers
0

New recordset in CS3 error using wildcard (ASP)

New Here ,
Jun 27, 2009 Jun 27, 2009

Copy link to clipboard

Copied

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

TOPICS
Server side applications

Views

806
Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 27, 2009 Jun 27, 2009

Copy link to clipboard

Copied

Thread moved to the appropriate forum: Dreamweaver Application Development.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines
LEGEND ,
Jun 28, 2009 Jun 28, 2009

Copy link to clipboard

Copied

LATEST

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.

Votes

Translate

Report

Report
Community guidelines
Be kind and respectful, give credit to the original source of content, and search for duplicates before posting. Learn more
community guidelines