Ask a Question related to ASP.NET Data Grid Control, Design and Development.
-
Jim Bancroft #1
Converting SQL Server "bit" field to a CLR boolean-- has to be a better way
I'm using the DataBinder.Eval() method to output the value of a SQL Server
bit field. In order to convert this value to a boolean I go through the
machination below. So far it's the only way I've been able to make this to
work; every other attempt yields an illegal-conversion or other syntax
error:
<%# Convert.ToBoolean(Convert.ToByte(DataBinder.Eval(C ontainer.DataItem,
"myBitField"))) %>
This snippet does the job (or at least in my tests it does), but it can't be
the most efficient way to go....can it?
Jim Bancroft Guest
-
"Page" and "Rect" props of the Field prop in Javascript API
Page property of the Field property in Javascript Acrobat API returns an array of pages that this field exists in. On the other hand, "rect" property... -
#39904 [NEW]: string -> boolean conversion of "\0" could give FALSE
From: zizka at seznam dot cz Operating system: PHP version: 5.2.0 PHP Bug Type: Feature/Change Request Bug description: ... -
Compare 2 fields & delete everything in "field 2" that occurs in "field 1"
Is it possible to compare 2 fields and delete everything in "field 2" that also occurs in "field 1" ? FIELD1 800-555-1212 for... -
Request.Form("Field Name") Versus Request.QueryString("Field Name")
I want to know what's the differences between Request.Form("Field Name") and Request.QueryString("Field Name") OR they function exactly the... -
dr("field").toString returns "400.0000" instead of "400"
I have just installed VS.NET 2003 on my computer. I have a project that I have been developing on VS.NET 2002. I haven't upgraded this project to... -
Jon Skeet [C# MVP] #2
Re: Converting SQL Server "bit" field to a CLR boolean-- has to be a better way
Jim Bancroft <asdfsklw@nowhere.com> wrote:
I suggest you log what> I'm using the DataBinder.Eval() method to output the value of a SQL Server
> bit field. In order to convert this value to a boolean I go through the
> machination below. So far it's the only way I've been able to make this to
> work; every other attempt yields an illegal-conversion or other syntax
> error:
>
> <%# Convert.ToBoolean(Convert.ToByte(DataBinder.Eval(C ontainer.DataItem,
> "myBitField"))) %>
>
> This snippet does the job (or at least in my tests it does), but it can't be
> the most efficient way to go....can it?
DataBinder.Eval(Container.DataItem, "myBitField").GetType() returns -
that should let you know what's actually there, which will make it
easier to work out what to do with it.
--
Jon Skeet - <skeet@pobox.com>
[url]http://www.pobox.com/~skeet[/url]
If replying to the group, please do not mail me too
Jon Skeet [C# MVP] Guest



Reply With Quote

