Retrieving a numeric cookie for a query

Results 1 to 2 of 2

Thread: Retrieving a numeric cookie for a query

  1. #1
    Join Date
    Dec 1969

    Default Retrieving a numeric cookie for a query

    I am trying to retrieve a numeric value from a cookie to use to query a database, but it is not working. When I hard-code a number into the query it works. Is there a special way to treat numeric cookies perhaps?

  2. #2
    Join Date
    Dec 1969

    Default Did you THOROUGHLY debug?

    Cookies, like values from Request.Form and Request.QueryString are always strings. Which means you could use CINT or CLNG or CDBL to ensure the cookie value is converted to a numeric value.<BR><BR>But more than likely this is not your problem. <BR><BR>After all, if you are building a SQL query, the query is a STRING ANYWAY. So it really doesn&#039;t matter whether you start with<BR><BR>&#060;%<BR>somevar = "7"<BR>%&#062;<BR>or<BR>&#060;%<BR>somevar = 7<BR>%&#062;<BR>when you generate<BR>&#060;%<BR>SQL = "SELECT * FROM table WHERE someField = " & somevar<BR>%&#062;<BR>the resultant SQL query will be 100% identical.<BR><BR>So...<BR><BR>Have you debugged? Have you done the minimal RESPONSE.WRITE calls to be sure that the value you are getting from the cookie is what you think it is? Have you done a RESPONSE.WRITE of the SQL query to verify that it contains what you expect it to?<BR><BR>Pardon my suspicion, but so many questions like this turn out to be the result of a lack of debugging.<BR><BR><BR>

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts