Solved

ASP - Type Mismatch Error using LEFT

Posted on 2007-11-21
2
477 Views
Last Modified: 2012-05-05
Hi

I have a form which posts a series of orderid deliminated by a comma, the following code splits the order numbers

Dim arrRegistrants
 arrRegistrants=Split(Request.Form("orderid"),",")
 
I then need to get the 1st number of the orderid.. ie. if the order number is 400001 then i need 4 if it was 600001 then I need to get 6, so I added the following

DIM refid
refid =  LEFT ((arrRegistrants) ,2)
response.write refid

but I get this error
Microsoft VBScript runtime error '800a000d'
Type mismatch

any help appreciated


0
Comment
Question by:sparky74
2 Comments
 
LVL 7

Expert Comment

by:SjoerdvW
ID: 20326962
http://www.dotnet247.com/247reference/msgs/18/92373.aspx:

You are working in a Form class which has a Left property. The reason Left() returns an integer is because VB assumes you want to use the method/property that exists in the same, or closest imported, scope that you are working (hence, MyForm.Left, a property of the inherited class that you are working in, is more logical to assume than Microsoft.VisualBasic.Strings.Left()).

Try any of these:

Microsoft.VisualBasic.Strings.Left(Str, Len)
Microsoft.VisualBasic.Left(Str, Len)
Strings.Left(Str, Len)
0
 
LVL 47

Accepted Solution

by:
Wayne Taylor (webtubbs) earned 500 total points
ID: 20326976
HI sparky74,

The variable 'arrRegistrants' is an array, as specified by the use of the Split function. To use the Left function on a string in that array, you need to specify the index of the item....

    DIM refid
    refid =  LEFT ((arrRegistrants(0)) ,2)
    response.write refid

Regards,

Wayne
0

Featured Post

Courses: Start Training Online With Pros, Today

Brush up on the basics or master the advanced techniques required to earn essential industry certifications, with Courses. Enroll in a course and start learning today. Training topics range from Android App Dev to the Xen Virtualization Platform.

Question has a verified solution.

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

I recently decide that I needed a way to make my pages scream on the net.   While searching around how I can accomplish this I stumbled across a great article that stated "minimize the server requests." I got to thinking, hey, I use more than one…
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 Micro Tutorial will teach you how to censor certain areas of your screen. The example in this video will show a little boy's face being blurred. This will be demonstrated using Adobe Premiere Pro CS6.
Established in 1997, Technology Architects has become one of the most reputable technology solutions companies in the country. TA have been providing businesses with cost effective state-of-the-art solutions and unparalleled service that is designed…

785 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