Solved

Type mismatch on the Split function

Posted on 2002-03-19
10
625 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
  • 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
 
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
Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

 
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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
C# page opens in new window 3 55
Classic ASP - SQL Server connection problem 5 61
format nvarchar field as mm/dd/yyyy 4 61
Bypass cross origin issues on development site 3 64
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
I was asked about the differences between classic ASP and ASP.NET, so let me put them down here, for reference: Let's make the introductions... Classic ASP was launched by Microsoft in 1998 and dynamically generate web pages upon user interact…
This is used to tweak the memory usage for your computer, it is used for servers more so than workstations but just be careful editing registry settings as it may cause irreversible results. I hold no responsibility for anything you do to the regist…
In this video I am going to show you how to back up and restore Office 365 mailboxes using CodeTwo Backup for Office 365. Learn more about the tool used in this video here: http://www.codetwo.com/backup-for-office-365/ (http://www.codetwo.com/ba…

867 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

Need Help in Real-Time?

Connect with top rated Experts

15 Experts available now in Live!

Get 1:1 Help Now