Expected end of statement asp

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • sureshl
    New Member
    • Jan 2009
    • 23

    Expected end of statement asp

    Page opens like this....
    phone:123243453
    email:henria@re al.com

    but aftr clicking that button

    I need to display like this..
    phone:12324****
    email:hen***@** ****
    Error on this line:::

    dim textsize=Len(te xt)
    Expected end of statement
    Can any1 suggest how to proceed..??
    [code=asp]<%
    Function getPhone(text)
    dim textsize=Len(te xt)
    text = Left(text,5)
    For index = 0 to textsize
    text &= "*"
    Next
    return text
    End Function
    Function getEmail(text)
    dim textsize=Len(te xt)
    dim atpos = text.IndexOf("@ ") - 5
    text = Left(text,5)
    For index = 0 to textsize
    if atpos = index+1 then
    text &= "@"
    else
    text &= "*"
    endif
    Next
    return text
    End Function
    id = 1
    sSql = "SELECT phone,email FROM nametable WHERE userID = " & id
    oRs.Open sSql, oConn
    While not oRs.EOF
    Response.write( "<table><tr><fo rm method='post'>< td >phone : </td><td>"&getPho ne(ors(0))&"</td><td width='10%'alig n='right'mail :</td><td>"&getEma il(ors(1))&"</td><inputname=' submit' type='submit' value='check'></form></tr></table>")
    oRs.MoveNext()
    Wend
    %> [/code]
    Last edited by jhardman; Jan 8 '09, 10:04 PM. Reason: put code in code tags. please note button marked #
  • Nicodemas
    Recognized Expert New Member
    • Nov 2007
    • 164

    #2
    Again, please remember to post code inside [code] tags.

    Your problem is with the following statement, which appears in both getEmail() and getPhone():

    Code:
    dim textsize=Len(text)
    '- and -
    dim atpos = text.IndexOf("@") - 5
    Dim statements are not like JavaScript var statements. You cannot assign a value on the same line as a Dim unless you separate the dim and the assignment statements with a colon (":").

    It should be:
    Code:
    dim textsize : textsize = len(text)
    dim atpos    : atpos = text.IndexOf("@") - 5
    Last edited by Nicodemas; Jan 8 '09, 05:09 PM. Reason: identified where in code the problems were

    Comment

    • Soniad
      New Member
      • Jan 2009
      • 66

      #3
      Expected end of statement asp

      Yes, i agree with Nicodemas, you must declare the variable first, and then assign value to that variable .

      Ex :
      dim textsize

      textsize=Len(te xt)

      Comment

      Working...