If Statement

Results 1 to 2 of 2

Thread: If Statement

  1. #1
    Join Date
    Dec 1969

    Default If Statement

    Hi,<BR><BR>Im having problems getting the following code to work:<BR><BR>HttpCookie cookie = Request.Cookies["Category"];<BR><BR>string strCategory = cookie.Value.ToString().Trim();<BR><BR>if(strCateg ory == "Reseller")<BR>{<BR>string sqlNewProducts = "SELECT TOP 5 PID, ProductName, ProductDesc, InStock, ImagePath, ResPrice AS DisplayPrice FROM Product";<BR>}<BR><BR>The cookie value is being returned correctly, and can be added to a label control and printed out to the page.<BR><BR>However, the If statement doesnt run and I really cant work out why.<BR><BR>Any ideas...<BR><BR>Thanks

  2. #2
    Join Date
    Dec 1969
    Indianapolis, IN

    Default RE: If Statement

    strCategory must not be equal to "Reseller". Try to print the value of strCategory, but write it out like this:<BR>"x" + strCategory + "x"<BR>I know you&#039;re doing a Trim() on the string, but I wonder if there are spaces in strCategory. I&#039;ve had this happen to me on more than one occasion.

Posting Permissions

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