[thelist] Boolean and asp and access

Ken Schaefer ken at adOpenStatic.com
Mon Jan 26 22:34:48 CST 2004


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Lightning" <oktellme at earthlink.net>
Subject: [thelist] Boolean and asp and access


: Does anyone know how access actually views boolean?
: I thought it was 0 or 1. Someone said they think it is +0
: and -1.  Since Access will display it as true/false or
: yes/no, I've got no clue.
:
: Anyhow, I am trying to update a boolean field with sql,
: and it's not recognizing anything I give it.
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

You can use "True" and "False". No need to remember what the values are per
se.

<%
strSQL = _
    "UPDATE myTestTable " & _
    "SET myTrueField = True, " & _
    "myFalseField = False"

Response.Write(strSQL)

objConn.Execute strSQL,,adCmdText+adExecuteNoRecords
%>

Alternatively, it'd be very easy to test what you need to supply. If you
create a table with three boolean fields (plus a primary key of some kind),
then run the following query:

UPDATE
    myTestTable
SET
    myTestField1 = 1,
    myTestField2 = 0,
    myTestField3 = -1
WHERE
    myPrimaryKey = 1

you will see the results of using various different numbers. HTH

Cheers
Ken

Microsoft MVP - Windows Server (IIS)



More information about the thelist mailing list