Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

split problem

Status
Not open for further replies.

daveigh

Programmer
Oct 9, 2003
105
Why do i seem to get this error:

Microsoft VBScript runtime error '800a000d'
Type mismatch

On this line:
ref = Split(rs("referrer"))

???


_______________CRYOcoustic_____________
 
Hello daveigh,

Code:
<quote>
Returns a zero-based, one-dimensional array containing a specified number of substrings.

Split(expression[, delimiter[, count[, compare]]])
Arguments
expression 
Required. String expression containing substrings and delimiters. If expression is a zero-length string, Split returns an empty array, that is, an array with no elements and no data. 
delimiter 
Optional. String character used to identify substring limits. If omitted, the space character (&quot; &quot;) is assumed to be the delimiter. If delimiter is a zero-length string, a single-element array containing the entire expression string is returned. 
count 
Optional. Number of substrings to be returned; -1 indicates that all substrings are returned. 
compare 
Optional. Numeric value indicating the kind of comparison to use when evaluating substrings. See Settings section for values. 
</quote>

So basically you ask yourself, split with respect to what &quot;delimter&quot;.

regards - tsuji
 
changed my code to:

ref = Split(rs(&quot;referrer&quot;),&quot;,&quot;)

still it returns the same error..

_______________CRYOcoustic_____________
 
daveigh,

There usually is no magic. You have to make sure rs(&quot;referer&quot;) return a string.

- tsuji
 
yes, there is. i tried to debug it by using response.write rs(&quot;referrer&quot;) and this string appears:

,google,

and what i wanted to do is to display it this way:


google

thats why i used split with a delimeter of &quot;,&quot; but that error appears...

_______________CRYOcoustic_____________
 
Have you tried this ?
Code:
ref = Split(CStr(rs(&quot;referrer&quot;)),&quot;,&quot;)

Hope This Help
PH.
 
yes i tried, PHV, but the same error occurs...tnx for ur help anyway...im still debugging it...


_______________CRYOcoustic_____________
 
Heya Dave..

Why don't you just use replace functionality..

Ref = replace(rs(&quot;referrer&quot;), &quot;,&quot; ,&quot;&quot;)

Should do the trick

Jay
 
well, you should get the same error message if you try and use the replace function. thats assuming you have implemented the split function correctly

i would go so far as to explicitly set all the param

aArray = Split(CStr(rs(&quot;reffer&quot;), &quot;,&quot;,-1,1)

if that still doesnt work then you either are not returning a string or should i say something that cant be converted to a string, or its null i guess.

check the variant type before each split call and also check for IsNull
 
Heya again..

The following line will split your &quot;referrer&quot; column into an array:

ref = Split(rs(&quot;referrer&quot;),&quot;,&quot;)

If you try to use this ref variable without an array number you'll end up with the type mismatch error message.
->

wscript.echo(ref) 'will return that error message

Actually you'll have an array with 3 columns according to your &quot;,google,&quot; example (2 commas = 3 columns :))

wscript.echo(ref(0)) 'will return an empty value
wscript.echo(ref(1)) 'will return google
wscript.echo(ref(2)) 'will return an empty value

So I'd suggest you to replace those commas rather that split your recordset value into columns..
In case you don't really need all those splitted values..

Jay


 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top