Go Premium for a chance to win a PS4. Enter to Win

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 755
  • Last Modified:

Type mismatch on the Split function

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
Pecos
Asked:
Pecos
  • 4
  • 3
  • 2
  • +1
1 Solution
 
thunderchickenCommented:
try

lineitem = split("1,2,3",",",-1,1)
for z = lbound(lineitem) to ubound(lineitem)
  response.write lineitem(z)
next 'z
0
 
msdixonCommented:
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
 
ebosscherCommented:
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
Industry Leaders: 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!

 
msdixonCommented:
true, but if there isn't a coma in the string, it won't get split into an array.
0
 
PecosAuthor Commented:
Ok, thanks anyway, but it worked when I did this:

public lineitem
lineitem = Split("1,2,3",",")
0
 
ebosscherCommented:
then it should return a zero based array.
0
 
ebosscherCommented:
see..
removed the array definition..

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

i was right
0
 
PecosAuthor Commented:
nope, when I tried just 'dim lineitem' it didn't work either.
0
 
PecosAuthor Commented:
but i'll give it to you anywayz
0
 
ebosscherCommented:
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

  • 4
  • 3
  • 2
  • +1
Tackle projects and never again get stuck behind a technical roadblock.
Join Now