[thelist] getting data from 'bit' datatype in asp

Chris Blessing webguy at mail.rit.edu
Wed Jul 10 12:23:01 CDT 2002


Michael-

As far as I know, ASP will interpret 1's and 0's as true/false values
accordingly.  You needn't explicitly convert them to a boolean type value
since everything's a variant anyhow.

Also, just so you're aware, it's always nice to store your db results in
page-level variables instead of directly accessing the record set over and
over again (particularly if you're just hitting it once and using the values
down the page several times).  Something like this would be optimal:

	dim isActive
	isActive = objRS("active")

	... down the page ...

	<B>Are you active?</B> <% = isActive %>
	<INPUT TYPE="hidden" NAME="isActive" VALUE="<% = isActive %>">

HTH!

Chris Blessing
webguy at mail.rit.edu
http://www.330i.net


> I have some fields stored as "bit" datatypes in SQL Server that I need to
> connect to. What is the right way. For example I write data to
> the field no
> problem with something like:
>
> objRs.fields("active").value= 1
>
> but if i want to get the data like this:
>
> if objRs.fields("active").value= 1 then   OR
> if objRs.fields("active").value= true then
>
> it doesn't work. Is there something I'm missing.
>
> Also if I want a form element value to be put in one of these fields, what
> is the right value setting?
>
> <input type="radio" name="myButton" value="true">
> <input type="radio" name="myButton" value="1">
> <input type="radio" name="myButton" value="???">
>
> Thanks




More information about the thelist mailing list