Solved

ASP - Type Mismatch Error using LEFT

Posted on 2007-11-21
2
481 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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

Free Tool: SSL Checker

Scans your site and returns information about your SSL implementation and certificate. Helpful for debugging and validating your SSL configuration.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
jquery to restrict certain words from input in form 11 47
Help with query 3 37
SQL to JSON 14 40
Ajax on ASP 2 42
Have you ever needed to get an ASP script to wait for a while? I have, just to let something else happen. Or in my case, to allow other stuff to happen while I was murdering my MySQL database with an update. The Original Issue This was written…
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…
Nobody understands Phishing better than an anti-spam company. That’s why we are providing Phishing Awareness Training to our customers. According to a report by Verizon, only 3% of targeted users report malicious emails to management. With compan…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

726 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