View Single Post
  #18 (permalink)  
Old July 3rd, 2008, 03:26 PM
Old Pedant Old Pedant is offline
Friend of Wrox
Join Date: Jun 2008
Location: Snohomish, WA, USA
Posts: 1,649
Thanks: 3
Thanked 141 Times in 140 Posts

quote:Error Type:
Microsoft VBScript compilation (0x800A0401)
Expected end of statement
/glenvistaCS3_web/News_Results.asp, line 59, column 61
Response.Write("Value is """ & session("AccessLevel")) & """")
You have mismatched parentheses. Always count left and right parens. The numbers must match.

VBScript (and VB.NET) uses a *pair* of quote marks embedded in a quoted string to represent ONE quote mark of actual text.

That is, doing
    Response.Write """"
will produce only a single
to the browser.

Personally, for debugging like this, I avoid using " marks and use some other delimiter. Just easier to read and write.

Also, it's actually a (very minor) error to use parentheses around the argument to Response.Write [doesn't apply in VB.NET, only in VBScript]. So, I would have used:
Response.Write "Session(AccessLevel) is ==" & Session("AccessLevel") & "==" & vbNewLine
or something like that.

I think Imar and I are both of the opinion that your Session("AccessLevel") value is *NOT* a numeric value and is clearly not 1, which is why you are getting the results you are seeing. It makes sense: If the admin is logged in then his
will (presumabely) be indeed his memberid. So if
is *NOT* the number 1, then of course you will get the same results for him you do for any other user: Only records with his memberid.

Tell you what. Why don't we really really carefully explore this?

Instead of *JUST* doing the dump of that value (as above) let's do some major checking of the value:
level = Session("AccessLevel")
isNum = IsNumeric(level)
strLen = Len(level)
vtype = TypeName(level)
Response.Write "Session(AccessLevel) is ==" & level & "==<br>" _
        & "Is it numeric? " & isNum & "<br>" _
        & "As a string, length is " & strLen & "<br>" _
        & "And its TypeName is " & vtype & "" & vbNewLine

See if *THAT* gives us enough info to find the bug.