Strange Issue with ASP displaying records

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • J P Singh

    Strange Issue with ASP displaying records

    We have a small application to track holidays of our employees.

    strUserId = session("UserId ")
    strSQL = "SELECT * From holidayrequests where UserId="& strUserId &
    " ORDER by Status"

    I run the above query which for most part returns the results fine but
    occassionally it omits records. i check in the database and these records
    are present and when I view the details of the same user through the admin
    section of the script all the records are returned.

    It only happens with just one user.

    Has anyone seen this happen? Any Ideas how to resolve this.

    Regards


  • Evertjan.

    #2
    Re: Strange Issue with ASP displaying records

    J P Singh wrote on 23 feb 2004 in
    microsoft.publi c.inetserver.as p.general:
    [color=blue]
    > strSQL = "SELECT * From holidayrequests where UserId="&
    > strUserId & " ORDER by Status"
    >[/color]

    "... WHERE UserId = '" & strUserId & "' ORDER by Status"

    A litteral string needs to be quoted in SQL.

    --
    Evertjan.
    The Netherlands.
    (Please change the x'es to dots in my emailaddress)

    Comment

    • Bob Barrows [MVP]

      #3
      Re: Strange Issue with ASP displaying records

      J P Singh wrote:[color=blue]
      > We have a small application to track holidays of our employees.
      >
      > strUserId = session("UserId ")
      > strSQL = "SELECT * From holidayrequests where UserId="&[/color]

      Evertjan is assuming that UserID is a character field. If it's numeric, then
      quoting the search criterion will result in a type mismatch.

      I think you need to use some basic debugging and "response.w rite strsql" so
      we can see the actual statement that is resulting in the faulty results.

      Bob Barrows

      PS. Please read this: http://www.aspfaq.com/show.asp?id=2096
      --
      Microsoft MVP -- ASP/ASP.NET
      Please reply to the newsgroup. The email account listed in my From
      header is my spam trap, so I don't check it very often. You will get a
      quicker response by posting to the newsgroup.


      Comment

      • Evertjan.

        #4
        Re: Strange Issue with ASP displaying records

        Bob Barrows [MVP] wrote on 23 feb 2004 in
        microsoft.publi c.inetserver.as p.general:[color=blue]
        > Evertjan is assuming that UserID is a character field. If it's
        > numeric, then quoting the search criterion will result in a type
        > mismatch.[/color]

        Right, Bob, not quite bright of me.

        --
        Evertjan.
        The Netherlands.
        (Please change the x'es to dots in my emailaddress)

        Comment

        Working...