Solved

ASP - Type Mismatch Error using LEFT

Posted on 2007-11-21
2
475 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

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

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…
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…
Along with being a a promotional video for my three-day Annielytics Dashboard Seminor, this Micro Tutorial is an intro to Google Analytics API data.
Both in life and business – not all partnerships are created equal. As the demand for cloud services increases, so do the number of self-proclaimed cloud partners. Asking the right questions up front in the partnership, will enable both parties …

910 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

24 Experts available now in Live!

Get 1:1 Help Now