If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Data Access, Manipulation & Batch Languages > ASP > retrieving data from recordset

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 10-02-03, 14:06
kristine kristine is offline
Registered User
 
Join Date: Sep 2003
Posts: 3
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
Reply With Quote
  #2 (permalink)  
Old 10-02-03, 19:16
Seppuku Seppuku is offline
Useless...
 
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.
Reply With Quote
  #3 (permalink)  
Old 10-03-03, 08:21
kristine kristine is offline
Registered User
 
Join Date: Sep 2003
Posts: 3
Smile

Thanks! It worked...

Kristine
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On