Solved

Type mismatch on the Split function

Posted on 2002-03-19
10
650 Views
Last Modified: 2012-08-14
I get the following error:
Microsoft VBScript runtime error '800a000d'
Type mismatch
/updateNames.asp, line 76

line 76 looks like this: lineitem = Split("1,2,3",",")
I do dim lineitem() above

any ideas why ASP doesn't like my Split() call??

thanks in advance.
0
Comment
Question by:Pecos
[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
  • 2
  • +1
10 Comments
 
LVL 11

Expert Comment

by:thunderchicken
ID: 6880442
try

lineitem = split("1,2,3",",",-1,1)
for z = lbound(lineitem) to ubound(lineitem)
  response.write lineitem(z)
next 'z
0
 
LVL 9

Expert Comment

by:msdixon
ID: 6880553
if instr(1, lineitem, ",") > 0 then
    lineitem = Split("1,2,3",",")
else
    ' you'll probably have to redim here, but this will give you a place to start
    lineitem = array(lineitem)
end if
0
 
LVL 6

Expert Comment

by:ebosscher
ID: 6880672
try dimming the lineitem without the dynamic array qualifier.

i.e.  you currently do it like this:

dim lineitem()

try this:

dim lineitem

the split function is looking for a variant, not an array of variants
0
Independent Software Vendors: 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 9

Expert Comment

by:msdixon
ID: 6880678
true, but if there isn't a coma in the string, it won't get split into an array.
0
 

Author Comment

by:Pecos
ID: 6880684
Ok, thanks anyway, but it worked when I did this:

public lineitem
lineitem = Split("1,2,3",",")
0
 
LVL 6

Expert Comment

by:ebosscher
ID: 6880687
then it should return a zero based array.
0
 
LVL 6

Accepted Solution

by:
ebosscher earned 100 total points
ID: 6880689
see..
removed the array definition..

went from dim lineitem()
to dim lineitem    (effectively)

i was right
0
 

Author Comment

by:Pecos
ID: 6880699
nope, when I tried just 'dim lineitem' it didn't work either.
0
 

Author Comment

by:Pecos
ID: 6880703
but i'll give it to you anywayz
0
 
LVL 6

Expert Comment

by:ebosscher
ID: 6880710
where did you declare the lineitem variable?
did it move out of scope in your function?

if so the public would have changed things.
0

Featured Post

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!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Server Timeout with Loop 6 59
ASP AND XML 3 30
SP inserts data with order number, then push the rest one order up 11 17
Validating number not work with decimal 4 24
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/…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

749 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