Solved

Type Mismatch - QueryString

Posted on 2006-06-29
7
286 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
[X]
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
  • 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
Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

 
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

Instantly Create Instructional Tutorials

Contextual Guidance at the moment of need helps your employees adopt to new software or processes instantly. Boost knowledge retention and employee engagement step-by-step with one easy solution.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
IP API - need data... 4 31
ASP server side get value 15 47
Writing comments on <p></P> or paragraph 2 23
VBScript on Html 15 58
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 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/…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …
The Email Laundry PDF encryption service allows companies to send confidential encrypted  emails to anybody. The PDF document can also contain attachments that are embedded in the encrypted PDF. The password is randomly generated by The Email Laundr…

733 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