Solved

ASP - Type Mismatch Error using LEFT

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

What Security Threats Are You Missing?

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

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 demonstration started out as a follow up to some recently posted questions on the subject of logging in: http://www.experts-exchange.com/Programming/Languages/Scripting/JavaScript/Q_28634665.html and http://www.experts-exchange.com/Programming/…
Here's a very brief overview of the methods PRTG Network Monitor (https://www.paessler.com/prtg) offers for monitoring bandwidth, to help you decide which methods you´d like to investigate in more detail.  The methods are covered in more detail in o…
In this tutorial you'll learn about bandwidth monitoring with flows and packet sniffing with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're interested in additional methods for monitoring bandwidt…

708 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

19 Experts available now in Live!

Get 1:1 Help Now