Classic ASP Variable Question

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • polymorphic
    New Member
    • Oct 2006
    • 28

    Classic ASP Variable Question

    I have passed some variables via a querystring to an asp page. The variables are passing ok but when I try to concatenate them into a string sql statement they are not appearing:

    For example:

    Code:
    dim RecordID, callerPage, FlaggerID
    
    RecordID = Request("edit")
    callerPage = Request("callerPage")
    FlaggerID = Request("flagger")
    
    'Response.Write ("flagger is: " & FlaggerID)   '<-------variables will print here!
    'Response.Write ("  /     RecordID is : " & RecordID)
    
    if request("act") = "update" then
    sql_update = "Update TimeAct set reviewerNotes= '" & replace(request("reviewerNotes"),"'", "''") & "'"
    sql_update = sql_update & ", Flagged = 1, FlaggerID = " & FlaggerID & ", FlaggedDate = '" & Now() & "' where [ID] = " & RecordID
    response.Write sql_update   '<---------Variables do not show here in this string!
    response.end
    conn.Execute sql_update
    What am I doing wrong? I've tried using a straight Request("flagge r") in the concatenation and that did not work.

    Thanks,
    cj
  • ilearneditonline
    Recognized Expert New Member
    • Jul 2007
    • 130

    #2
    Originally posted by polymorphic
    Code:
    dim RecordID, callerPage, FlaggerID
     
    RecordID = Request("edit")
    callerPage = Request("callerPage")
    FlaggerID = Request("flagger")
     
    'Response.Write ("flagger is: " & FlaggerID) '<-------variables will print here!
    'Response.Write (" / RecordID is : " & RecordID)
     
    if request("act") = "update" then
    sql_update = "Update TimeAct set reviewerNotes= '" & replace(request("reviewerNotes"),"'", "''") & "'"
    sql_update = sql_update & ", Flagged = 1, FlaggerID = " & FlaggerID & ", FlaggedDate = '" & Now() & "' where [ID] = " & RecordID
    response.Write sql_update '<---------Variables do not show here in this string!
    response.end
    conn.Execute sql_update
    What am I doing wrong? I've tried using a straight Request("flagge r") in the concatenation and that did not work.

    Thanks,
    cj
    Are you sure this is happening? If I comment this out, I can get the code to display properly.

    Code:
     if request("act") = "update" then

    Comment

    • polymorphic
      New Member
      • Oct 2006
      • 28

      #3
      Originally posted by ilearneditonlin e
      Are you sure this is happening? If I comment this out, I can get the code to display properly.

      Code:
       if request("act") = "update" then
      The SQL output I get is:

      Update TimeAct set reviewerNotes= 'ddd', Flagged = 1, FlaggerID = , FlaggedDate = '7/25/2007 2:37:26 PM' where [ID] =

      If I change the code to:

      Code:
      sql_update = "Update TimeAct set reviewerNotes= '" & replace(request("reviewerNotes"),"'", "''") & "'"
      sql_update = sql_update & ", Flagged = 1, 
      FlaggerID = " & Request.Form("FlaggerID") & 
      ", FlaggedDate = '" & Now() & "' where [ID] = " 
      & Request.Form("RecordID")
      then I can get the ID to pull:

      Update TimeAct set reviewerNotes= 'ddd', Flagged = 1, FlaggerID = , FlaggedDate = '7/25/2007 2:37:26 PM' where [ID] = 39987

      I am calling the page and passing these values as:

      Code:
      <A ID="<%=flagName%>" HREF="javascript:void();" onClick="popWin('/timesheet_Flag.asp?edit=<%=rs.Fields("ID")%>&callerPage=review&flagger=<% = FlaggerID%>', 'TimesheetFlag', 700,650); return false;">flag</A> <br>
      I don't know what is unique to the FlaggerID that the value is not appearing in the derived sql.

      Comment

      • ilearneditonline
        Recognized Expert New Member
        • Jul 2007
        • 130

        #4
        Except for the fact that I am not calling your page from a javascript popup, I have copied your code and get the results I would expect. Are you leaving out part of the code? Such as something between lines 8 and 10 that you previously displayed?

        Comment

        • jhardman
          Recognized Expert Specialist
          • Jan 2007
          • 3405

          #5
          just a hunch; do you have option explicit?

          Jared

          Comment

          Working...