Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

Type Mismatch - QueryString

Posted on 2006-06-29
7
285 Views
Last Modified: 2012-06-27
Hi,

Am am getting an error:

Error Type:
Microsoft VBScript runtime (0x800A000D)
Type mismatch: '[string: ""]'
/admin/includes/pages/retail/orders/view_order.asp, line 23

This type mismatch is on:

<%
Confirmation = killC(Request.QueryString("Confirmation"))
IF Confirmation = 1 THEN %> <-----------------------**************LINE 23******
      <p class="Confirm"><img src="/admin/images/ico_ok.gif">&nbsp;Order number <%=intOrderID%> has been re-opened.</p>
<% END IF %>
<% IF Confirmation = 2 THEN %>
      <p class="Confirm"><img src="/admin/images/ico_ok.gif">&nbsp;Order number <%=intOrderID%> has been cancelled.</p>
<% END IF %>

The confirmation variable is put through the function:

<%
Function killC(strWords)
     badChars = array("'","&rsquo;","&lsquo;","@","%")
     newChars = strWords
     for i = 0 to uBound(badChars)
          if ISNULL(newChars) then
          else
               newChars = replace(newChars, badChars(i), "`")
          end if
     next
     if ISNULL(newChars) then
     else
          'newChars = replace(replace(replace(newChars,vbcrlf,"<br />"),vbcr,"<br />"),vblf,"<br />")
     end if
     killC = newChars
     'Bad Word Array

End Function
%>

Doe anyone have any idea why this would be displaying type mismatch?

Regards,
Carl
0
Comment
Question by:net-workx
  • 4
  • 3
7 Comments
 

Author Comment

by:net-workx
ID: 17011649
A further note:

If i put <% ON ERROR RESUME NEXT %> then the page runs and displays but the two confirm messages display on the screen when there is no confirmation querystring.

Cheers,
Carl
0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 17011677
Try

IF Confirmation = "1" THEN
0
 

Author Comment

by:net-workx
ID: 17011734
that works, so its converted it into a text value, how would i go about converting back to a numerical value?
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 23

Expert Comment

by:Saqib Khan
ID: 17011752
Well your Function Accepts a Parameter, and that parameter is a String.
 Does your Function will Always Return a Numerical Value?
0
 
LVL 23

Accepted Solution

by:
Saqib Khan earned 500 total points
ID: 17011780
if Confirmation is always suppose to be a INT. then...
Confirmation = killC(cINT(Request.QueryString("Confirmation")))

then you can compare as a Integer.
0
 

Author Comment

by:net-workx
ID: 17011828
no, the fuction can sometimes pull a character in other pages but in this scenario it will always be numerical but if i use Confirmation = killC(cINT(Request.QueryString("Confirmation"))) whenever i know for sure it will will be a numerical that will convert it back?



0
 
LVL 23

Expert Comment

by:Saqib Khan
ID: 17011845
Function cInt "always" Expects and Integer. if your confirmation variable will be either INT or String randomly then you have no choice but to use this variable as a String/Variant and compare using string value instead of INT.
0

Featured Post

Free Tool: Postgres Monitoring System

A PHP and Perl based system to collect and display usage statistics from PostgreSQL databases.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
This demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…
Email security requires an ever evolving service that stays up to date with counter-evolving threats. The Email Laundry perform Research and Development to ensure their email security service evolves faster than cyber criminals. We apply our Threat…

791 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