473,387 Members | 1,541 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

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 17372
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
by: Arjen | last post by:
Hi All, What I want to is using a string as PATTERN in a split function. This makes it possible for me to change the PATTERN on one place in my script... For example: $separator = ";"; $line...
8
by: uc_sk | last post by:
Hello All I am a newbie to PERL language...If i have a file with data of form abcd 4 {1,2,3} 3 lmn- 3 {12,18,19,22} 4 then i can read them as... ($list $listTotal $set $noElements) = split /...
3
by: Joey Martin | last post by:
I need some basic SPLIT help. I need to be able to display the results for the split function. The SQL query will pull results like 123.jpg,ab123.jpg,whatever.jpg CURRENT CODE: SQLCommand =...
2
by: fhuntsman | last post by:
1) dhCountWorkdaysA comes from "Visual Basic Language Developer's Handbook" by Ken Getz and Mike Gilbert 2) I place this function and the other functions that are needed for this to work in...
6
by: dndfan | last post by:
Hello, In the short time I have spent reading this newsgroup, I have seen this sort of declaration a few times: > int > func (string, number, structure) > char* string > int number >...
3
by: James | last post by:
1 Dim db As Database 2 Set db = OpenDatabase("c:\videoStore\settings.mdb") 3 Dim rs As Recordset 4 Set rs = db.OpenRecordset("defaults", dbOpenTable) 5 ...
19
by: thisis | last post by:
Hi All, i have this.asp page: <script type="text/vbscript"> Function myFunc(val1ok, val2ok) ' do something ok myFunc = " return something ok" End Function </script>
3
by: cyberdwarf | last post by:
Hi Any idea why the following (cut down) function gives a "Type Mismatch" error? I've tried almost everything, in terms of arrays, etc, but I need to pass back 3 values (int, int, double)...
2
by: seanf67 | last post by:
vbscript: Spilt Issue My text files are delimited as follows: Record Delimiter: vbCRLF Field Delimiter: ~ I need to break each record apart based on the first field which defines the...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.