PDA

View Full Version : "invalid character" error (???)


CdnGal
01-13-2003, 12:21 AM
HI, all (newbie here)

Can someone please tell me why I get the error "invalid character, line 13, col 5..., (which is the line below that says d=dat etc), col 5 points to just before the d.....I've tried changing the "d" to other letters/name in case the "d" is used for something else in vb...but it still gives me the same error.


Here's part of the code from the asp page:


dim sSQL,oRST
dim oCN
oCN = OpenConnection()

Function medDate(dat)
dim mths
mths=Array("Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec")

dim d
d=dat? new Date(dat) : new Date()
return (mths[d.getMonth()] & " " & d.getDate() & ", " & d.getFullYear())
End Function

Thanks!

arnyinc
01-13-2003, 03:12 AM
I've never used that syntax in ASP. VBScript may not support a?b:c

whammy
01-14-2003, 12:54 AM
I'm guessing here too, because that looks like JScript syntax, which I never use server-side (unless within <script runat="server"> tags, and I haven't tried a ternary operand in JScript server-side)... have you tried:

d=dat ? new Date(dat) : new Date()

Note the space after "dat" before the "?"...

If that doesn't work, then perhaps server-side JScript doesn't support the ternary operand? Not sure about that... I know VBScript doesn't...

CdnGal
01-14-2003, 04:55 AM
Hi,

I tried it with the space...didn't work.

Any other suggestions? You're right....it IS Javascript syntax. But it needs to be written in VB. Any ideas how to re-write it in VB?

Thanks!