Results 1 to 3 of 3
  1. #1
    Join Date
    Sep 2003
    Posts
    3

    Unanswered: retrieving data from recordset

    Hello,

    Quick question: Suppose I have created a record set (called ProductRS) that includes all of the information about a given product based on productID. One of the "fields" in my record set is BOL and can have either a true or false value. If I want to set up an if then else statement so that I can print something to a web page according to whether the value of BOL is true or false, what should the code look like? I've tried the following:

    <%If ProductRS("BOL") = False Then
    response.write ProductRS("TOC")
    Else
    response.write ""
    End if%>

    For some reason the statement doesn't work, but I don't get an error message. It just doesn't do anything. Any insight on what's wrong with my code? Thanks!

    Kristine

  2. #2
    Join Date
    Jul 2003
    Location
    SoCal
    Posts
    721

    Re: retrieving data from recordset

    You need to cast the value from the recordset to boolean using the CBool() function (this is assuming the datatype for BOL is bit or int - bit being the better way to go for boolean values):

    Code:
    <%
    If CBool(ProductRS("BOL")) = False Then
    response.write ProductRS("TOC")
    Else
    response.write ""
    End if
    %>
    That which does not kill me postpones the inevitable.

  3. #3
    Join Date
    Sep 2003
    Posts
    3

    Smile

    Thanks! It worked...

    Kristine

Posting Permissions

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