Cookie datatype?

Results 1 to 2 of 2

Thread: Cookie datatype?

  1. #1
    Join Date
    Dec 1969

    Default Cookie datatype?

    Hi<BR>I have decided to use cookies to stored form inputs by user.. These values are needed in subsequent pages. I m using 2 dimensional cookie variable to store user login details in this form i.e. eg. (login)(userid).<BR>Are these cookies stored as strings? In subsequent pages i want to compare the userid with a userid (numeric)retrieved from a sql server database. The database value is retrieved using a recordset . Is the recordset value still numeric or is a string type?<BR>what datatype conversions do i need to do when comparing cooke value with numeric or with string? i am getting error of Null:Cstr when i am comparing with recordset value after cstr conversion.. and Null:Clng if i make the cookie Long type..<BR>please guid how to store data properly in cookies and use them <BR><BR>i m

  2. #2
    Join Date
    Dec 1969

    Default Cookies are, as far as I know,...

    ...basically text files, but the values stored in them should keep their type. However, it&#039;s always prudent to convert them, especially if you&#039;re having problems.<BR><BR>Values returned in a recordset are certainly typed, so conversion should not be required.<BR><BR>Also, if you compare a string with an integer for example, I think VBScript automatically converts the integer into a string and then compares the two, but I may be wrong - I&#039;m not a VBScript person.<BR><BR>If you get an error because of a null value, then that&#039;s a problem with the value that you want to convert - and not the conversion function. Maybe the value in your recordset is empty (i.e. null) or the cookie value isn&#039;t set. Do a Response.Write of those value before you do the CStr or CLng and see what they contain.<BR><BR>Oliver.

Posting Permissions

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