Syntax Error in IF statement

Discussion in 'ASP General' started by Nate, Feb 17, 2007.

  1. Nate

    Nate Guest

    I am trying to use the following IF statement, and whenever I use a
    single or double quote, I receive a syntax error. When using no
    quotes, the syntax is accepted, but the statement does not perform
    properly.

    ***The problem line***
    <% if violation_type=''Tardy'' THEN %>
    ***rest of the statement***
    TARDY VIOLATIONS
    <% if rs2.Fields(0) = 0 THEN %>
    This is the first unexcused Tardy violation for this employee. A
    coaching is required. Click <A HREF=blah>HERE</A> to issue the
    coaching.
    <% ELSE %>
    This employee has <%response.write(rs2.Fields(0))%> previous
    violations.
    <% END IF %>
    <% ELSE %>
    The <%response.write(violation_type)%> violation has been recorded.
    <% END IF %>

    Variables defined:
    violation_type = request.form("violation_type")

    Any ideas?
     
    Nate, Feb 17, 2007
    #1
    1. Advertising

  2. "Nate" <> wrote in message
    news:...
    > I am trying to use the following IF statement, and whenever I use a
    > single or double quote, I receive a syntax error. When using no
    > quotes, the syntax is accepted, but the statement does not perform
    > properly.
    >
    > ***The problem line***
    > <% if violation_type=''Tardy'' THEN %>


    Are you saying the above line as it is generates a syntax error??
     
    Anthony Jones, Feb 17, 2007
    #2
    1. Advertising

  3. Nate

    Nate Guest

    For some reason, it was. I loaded the code up into Source Edit and
    made some changes to other parts of the code, and suddenly it worked.
    I appreciate you taking the time to reply - must have been a fluke :-\

    On Feb 17, 8:31 am, "Anthony Jones" <> wrote:
    > "Nate" <> wrote in message
    >
    > news:...
    >
    > > I am trying to use the following IF statement, and whenever I use a
    > > single or double quote, I receive a syntax error. When using no
    > > quotes, the syntax is accepted, but the statement does not perform
    > > properly.

    >
    > > ***The problem line***
    > > <% if violation_type=''Tardy'' THEN %>

    >
    > Are you saying the above line as it is generates a syntax error??
     
    Nate, Feb 17, 2007
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. sean
    Replies:
    2
    Views:
    564
    Kevin Spencer
    Dec 2, 2003
  2. compuglobalhypermeganetz0r

    adapter update problem Syntax error in INSERT INTO statement.

    compuglobalhypermeganetz0r, Dec 8, 2003, in forum: ASP .Net
    Replies:
    0
    Views:
    848
    compuglobalhypermeganetz0r
    Dec 8, 2003
  3. Mark Sandfox
    Replies:
    1
    Views:
    3,428
    Mark Sandfox
    May 7, 2004
  4. Saber
    Replies:
    5
    Views:
    542
    Jo Inferis
    Jul 20, 2004
  5. Mark Richards
    Replies:
    3
    Views:
    336
    Tad McClellan
    Nov 18, 2007
Loading...

Share This Page