Using the Right function

orderBy is a querystring value which contains 2 characters (e.g.
orderBy=a0). The first is an "a" or "d" representing the sort sequence
and the second is a one digit number corresponding to the array index
of a field names.

The problem is that I get a type mismatch (Type mismatch:
'Right(...)' ) on this statement:

If (Request.Querystring("orderBy").Count = 0) Then
sortOrder = "ASC"
sortField = "ID"
Else
If Left(orderBy,1) <> "d" Then
sortOrder = "ASC"
Else
sortOrder = "DESC"
End If
sortField = columns(Right(orderBy,1))
End If

How should I be using the Right function?

Thank you!
Big Moxy [ Fr, 30 November 2007 01:56 ] [ ID #1882869 ]

Re: Using the Right function

"Big Moxy" <bigmoxy [at] gmail.com> wrote in message
news:83328a01-c270-4342-be46-3cc6cea1c12f [at] e25g2000prg.google groups.com...
> orderBy is a querystring value which contains 2 characters (e.g.
> orderBy=a0). The first is an "a" or "d" representing the sort sequence
> and the second is a one digit number corresponding to the array index
> of a field names.
>
> The problem is that I get a type mismatch (Type mismatch:
> 'Right(...)' ) on this statement:
>
> If (Request.Querystring("orderBy").Count = 0) Then
> sortOrder = "ASC"
> sortField = "ID"
> Else
> If Left(orderBy,1) <> "d" Then
> sortOrder = "ASC"
> Else
> sortOrder = "DESC"
> End If
> sortField = columns(Right(orderBy,1))
> End If
>
> How should I be using the Right function?

Try

sortField = columns(CInt(Right(orderBy,1)))
McKirahan [ Fr, 30 November 2007 05:00 ] [ ID #1882878 ]
Webserver » microsoft.public.inetserver.asp.general » Using the Right function

Vorheriges Thema: How can display the sql before the error occurs?
Nächstes Thema: Opening PDF within IE7 - file could not be written to cache