PDA

View Full Version : Getting Word To Print Based On Bit Field Value


SteveSensei
09-14-2006, 10:06 PM
Okay, this is driving me crazy, as it's happening in two different sites. I have a bit field in MS SQL Server with the value set to 1 or 0, representing True of False. The code I'm using to retrieve the data is:

<% If (rsTutorDetail.Fields.Item("availDay").Value) = True THEN Response.Write "Days" End If %>

The word Days does not print out until I add this next line above the code:

<% Response.Write (rsTutorDetail.Fields.Item("availDay").Value) %>

How can I get the word Days to print out without using both lines of code?

Baleric
09-17-2006, 10:46 AM
you are making it equal true not to equal 1, i think its checking if the data is on the page. then writing the statement.

try this.

<% If rsTutorDetail("availDay") = 1 THEN Response.Write "Days" End If %>

let us know how it went,

cheers

baleric

*edit* also i have been using asp in dreamweaver for ages and i thought it was the greatest, but i recommend you start to do your own code because dreamweaver has a massive ammount of limitations that will stop you from moving further.

cheers.

SteveSensei
09-18-2006, 02:12 AM
Hi Baleric,

I hand coded for 9 years and was dead set against any WYSIWYG programs, but once I got into database coding for web pages, Dreamweaver is the only way to go. Yes, it has its limitations, but overall, for connecting to a database it's a dream!

As for my problem, I solved it. It turned out that one of my large text fields was set to datatype ntext. This somehow prevented all the other fields from getting through to the page. Turning it into another type of text field solved the problem.