Velocity Reviews

Velocity Reviews (http://www.velocityreviews.com/forums/index.php)
-   ASP .Net (http://www.velocityreviews.com/forums/f29-asp-net.html)
-   -   Converting datareader value (http://www.velocityreviews.com/forums/t300875-converting-datareader-value.html)

Toska 06-25-2006 05:21 PM

Converting datareader value
 

Which method is the most effective.


-
bool b = (bool)dr["column"];
-
bool b = Convert.ToBoolean(dr["column"]);
-
bool b = dr.GetBoolean(0);
-
Other.




--
Toska
------------------------------------------------------------------------
Posted via http://www.codecomments.com
------------------------------------------------------------------------


sloan 06-26-2006 03:36 AM

Re: Converting datareader value
 
The pdf doesn't exist anymore, but I had this commented in my code:

//''FROM http://www.stevearnott.com/DAAG.pdf
// 'When accessing data by using the reader, use the typed
accessor methods (such
// 'as GetInt32 and GetString) if you know the column's
underlying data type
// 'because they reduce the amount of type conversion required
when you read
// 'column data.





"Toska" <Toska.29zfhr@mail.codecomments.com> wrote in message
news:Toska.29zfhr@mail.codecomments.com...
>
> Which method is the most effective.
>
>
> -
> bool b = (bool)dr["column"];
> -
> bool b = Convert.ToBoolean(dr["column"]);
> -
> bool b = dr.GetBoolean(0);
> -
> Other.
>
>
>
>
> --
> Toska
> ------------------------------------------------------------------------
> Posted via http://www.codecomments.com
> ------------------------------------------------------------------------
>





All times are GMT. The time now is 08:22 AM.

Powered by vBulletin®. Copyright ©2000 - 2014, vBulletin Solutions, Inc.
SEO by vBSEO ©2010, Crawlability, Inc.