?
Solved

Type Mismatch - QueryString

Posted on 2006-06-29
7
Medium Priority
?
288 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
Technology Partners: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
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 2000 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

Enroll in August's Course of the Month

August's CompTIA IT Fundamentals course includes 19 hours of basic computer principle modules and prepares you for the certification exam. It's free for Premium Members, Team Accounts, and Qualified Experts!

Question has a verified solution.

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

I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
I would like to start this tip/trick by saying Thank You, to all who said that this could not be done, as it forced me to make sure that it could be accomplished. :) To start, I want to make sure everyone understands the importance of utilizing p…
Monitoring a network: how to monitor network services and why? Michael Kulchisky, MCSE, MCSA, MCP, VTSP, VSP, CCSP outlines the philosophy behind service monitoring and why a handshake validation is critical in network monitoring. Software utilized …
Sometimes it takes a new vantage point, apart from our everyday security practices, to truly see our Active Directory (AD) vulnerabilities. We get used to implementing the same techniques and checking the same areas for a breach. This pattern can re…

765 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