469,366 Members | 2,243 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 469,366 developers. It's quick & easy.

Split() function gives type mismatch

Hello,

I have been having problems with some blindingly simple ASP that fails.
I have the following code ...

Dim sAds, sAdverts()
sAds = "1" & vbTab & "Ferret" & vbTab & "Furry" & vbCrLf
sAds = sAds & "2" & vbTab & "Gibbon" & vbTab & "HAiry" & vbCrLf
sAds = sAds & "3" & vbTab & "Vole" & vbTab & "Small" & vbCrLf
sAdverts = Split(sAds,vbCrLf)

Which gives a Type Mismatch error on the Split() line. I have done this
sort of thing loads of times before and can't understand why this isn't
working. The code above is a test version, designed to pinpoint the
problem lines. The real code is supposed to get data from a database and
convert the ADODB recordset to an array using GetRows(). When that
failed, I cut the code down to the above.

This is running on IIS6 on Windows 2003 Server. This is the first time I
have done any ASP on this machine (only just installed it). ASP seems to
be working fine as other stuff previously written goes without problems.

Any idea why Split() doesn't work?

TIA for any help.

--
Alan Silver
(anything added below this line is nothing to do with me)
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----
Jul 19 '05 #1
7 16840
You can't pre-assign sAdverts as an array. So, change:
Dim sAds, sAdverts()


to:

Dim sAds, sAdverts

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 19 '05 #2
Although this seems illogical, don't DIM your sAdverts variable as a dynamic
array. Do:

Dim sAds, sAdverts

instead of

Dim sAds, sAdverts()

Then all will be fine.

Ray at work

"Alan Silver" <al*********@nospam.thanx> wrote in message
news:JQ**************@nospamthankyou.spam...
Hello,

I have been having problems with some blindingly simple ASP that fails. I
have the following code ...

Dim sAds, sAdverts()
sAds = "1" & vbTab & "Ferret" & vbTab & "Furry" & vbCrLf
sAds = sAds & "2" & vbTab & "Gibbon" & vbTab & "HAiry" & vbCrLf
sAds = sAds & "3" & vbTab & "Vole" & vbTab & "Small" & vbCrLf
sAdverts = Split(sAds,vbCrLf)

Which gives a Type Mismatch error on the Split() line. I have done this
sort of thing loads of times before and can't understand why this isn't
working. The code above is a test version, designed to pinpoint the
problem lines. The real code is supposed to get data from a database and
convert the ADODB recordset to an array using GetRows(). When that failed,
I cut the code down to the above.

This is running on IIS6 on Windows 2003 Server. This is the first time I
have done any ASP on this machine (only just installed it). ASP seems to
be working fine as other stuff previously written goes without problems.

Any idea why Split() doesn't work?

TIA for any help.

--
Alan Silver
(anything added below this line is nothing to do with me)
-----= Posted via Newsfeeds.Com, Uncensored Usenet News =-----
http://www.newsfeeds.com - The #1 Newsgroup Service in the World!
-----== Over 100,000 Newsgroups - 19 Different Servers! =-----

Jul 19 '05 #3
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message news:<uq**************@TK2MSFTNGP10.phx.gbl>...
You can't pre-assign sAdverts as an array. So, change:
Dim sAds, sAdverts()


to:

Dim sAds, sAdverts


Thanx to both of you. Is this something that's changed between the
version of VBScript in IIS4 and the version in IIS6 ? I haven't done
much ASP for a while, and this is the first time I've used IIS6, but
I'm sure I used to have the brackets there before (yup, could be wrong
here !!).

Thanx again
Jul 19 '05 #4
Alan Silver wrote:
"Aaron [SQL Server MVP]" <te*****@dnartreb.noraa> wrote in message
news:<uq**************@TK2MSFTNGP10.phx.gbl>...
You can't pre-assign sAdverts as an array. So, change:
Dim sAds, sAdverts()


to:

Dim sAds, sAdverts


Thanx to both of you. Is this something that's changed between the
version of VBScript in IIS4 and the version in IIS6 ? I haven't done
much ASP for a while, and this is the first time I've used IIS6, but
I'm sure I used to have the brackets there before (yup, could be wrong
here !!).


Nope, it's always worked this way. You only use the parentheses when you are
dimensioning and populating the array yourself.

Bob Barrows

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #5
<snip>
Thanx to both of you. Is this something that's changed between the
version of VBScript in IIS4 and the version in IIS6 ? I haven't done
much ASP for a while, and this is the first time I've used IIS6, but
I'm sure I used to have the brackets there before (yup, could be wrong
here !!).


Nope, it's always worked this way. You only use the parentheses when you are
dimensioning and populating the array yourself.


OK, I told you it's been a while since I did any ASP ;-)

Thanx for the reply.

Whilst I've got your attention, do you know of any resources that will
update my ASP knowledge. I was a very competent ASP programmer a couple
of years back (I know, my question above doesn't make you think so !!)
and I don't really want an ASP 101 resource, I just want something that
will tell me what's new since IIS4. I have looked around, but not found
anything worthwhile yet. Any suggestions ?

Thanx

--
Alan Silver
(anything added below this line is nothing to do with me)
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 19 '05 #6
Alan Silver wrote:
<snip>
Thanx to both of you. Is this something that's changed between the
version of VBScript in IIS4 and the version in IIS6 ? I haven't done
much ASP for a while, and this is the first time I've used IIS6, but
I'm sure I used to have the brackets there before (yup, could be
wrong here !!).


Nope, it's always worked this way. You only use the parentheses when
you are dimensioning and populating the array yourself.


OK, I told you it's been a while since I did any ASP ;-)

Thanx for the reply.

Whilst I've got your attention, do you know of any resources that will
update my ASP knowledge. I was a very competent ASP programmer a
couple of years back (I know, my question above doesn't make you think so
!!)
and I don't really want an ASP 101 resource, I just want something
that will tell me what's new since IIS4. I have looked around, but
not found anything worthwhile yet. Any suggestions ?

Thanx

http://msdn.microsoft.com/library
www.aspfaq.com
www.iisfaq.com

Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jul 19 '05 #7
<snip>
Whilst I've got your attention, do you know of any resources that will
update my ASP knowledge. I was a very competent ASP programmer a
couple of years back (I know, my question above doesn't make you think so
!!)
and I don't really want an ASP 101 resource, I just want something
that will tell me what's new since IIS4. I have looked around, but
not found anything worthwhile yet. Any suggestions ?

Thanxhttp://msdn.microsoft.com/library


Having looked in vain here before, I just spent the last couple of hours
reading loads of articles that answered my questions completely !! Don't
know how I missed them at all.
www.aspfaq.com
Couldn't find anything that addressed this issue. Good site generally,
but failed me this time.
www.iisfaq.com


Didn't know about this one. Thanx for the link, I'll check it out.

--
Alan Silver
(anything added below this line is nothing to do with me)
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==----
http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
Jul 19 '05 #8

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

5 posts views Thread by Arjen | last post: by
8 posts views Thread by uc_sk | last post: by
3 posts views Thread by Joey Martin | last post: by
2 posts views Thread by fhuntsman | last post: by
6 posts views Thread by dndfan | last post: by
reply views Thread by zhoujie | last post: by
reply views Thread by suresh191 | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.