Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chriss Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with BIT fields in SQL Server

Status
Not open for further replies.
Jan 26, 2001
550
GB
Dear All

I am currently migrating our intranet from MS Access to SQL Server.
As I understand, SQL Server holds 'true/false' fields as BITs with 1 or 0 value, so I have adapted my code to suit this.

The problem i have is that, in my ASP, testing for '1' against the database value does not return true. Instead I have still have to test for 'true' against the field to get the right result.

e.g. If rs("TS_HOLIDAY") = 1 does not work
whereas If rs("TS_HOLIDAY") = True does work,

even though the field is actually a 1 or a 0.

Can anyone suggest why this might be happening? It's a simple matter to find and replace all =True with =1 etc. for the SQL queries but if i have to still use 'True' when testing against the field in the recordset it becomes a right pain in the backside.

Thanks in advance for your help

Nick (Webmaster)

 
AFAIK all front ends (at least these I am working with) convert internally BIT fields to Boolean type. So you don't have to change anything.

Borislav Borissov
VFP9 SP1, SQL Server 2000/2005.
MVP VFP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top