Print Page | Close Window

Type mismatch when splitting string

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: Classic ASP Discussion
Forum Description: Discussion on Active Server Pages (Classic ASP).
URL: https://forums.webwiz.net/forum_posts.asp?TID=11034
Printed Date: 31 March 2026 at 11:59am
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Type mismatch when splitting string
Posted By: gr8indianbear
Subject: Type mismatch when splitting string
Date Posted: 29 June 2004 at 10:56am

I am sending a querystring to a page and the page is splitting one of the values into an array. The code for splitting the string looks like this:

If Request.QueryString("hlight") = "" Then
 strHlight = ""
Else
 strHlight = Split(Request.QueryString("hlight")," ", -1)
End If

I recieve this error on my page:

Microsoft VBScript runtime error '800a000d'

Type mismatch: '[string: "god"]'

/display.asp, line 265

This is the code starting at line 264

   intHlight = 0
    Do While (strHlight(intHlight))
     strBody = Replace(rsCommon("Body"), strHlight(intHlight), "<span class='hlight'>" & strHlight(intHlight) & "</span>")
     intHlight = intHlight + 1
    Loop


Any ideas?




Replies:
Posted By: KCWebMonkey
Date Posted: 29 June 2004 at 1:37pm
Well, the error is pretty self-explanatory. You are getting an error due to the data type. Try casting it to the proper data type, like CStr for Strings or CInt for Integers.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net