Converting datareader value

Discussion in 'ASP .Net' started by Toska, Jun 25, 2006.

  1. Toska

    Toska Guest

    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
    ------------------------------------------------------------------------
     
    Toska, Jun 25, 2006
    #1
    1. Advertising

  2. Toska

    sloan Guest

    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" <> wrote in message
    news:...
    >
    > 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, Jun 26, 2006
    #2
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Catalin Porancea

    Value from a DataReader to a string

    Catalin Porancea, Nov 10, 2003, in forum: ASP .Net
    Replies:
    5
    Views:
    4,480
    vijay
    Nov 10, 2003
  2. Shapper
    Replies:
    1
    Views:
    539
    Lucas Tam
    Apr 22, 2005
  3. tshad
    Replies:
    3
    Views:
    3,940
    tshad
    May 31, 2005
  4. Shapper

    How to use a value of a datareader?

    Shapper, Jun 3, 2005, in forum: ASP .Net
    Replies:
    4
    Views:
    4,661
    Shapper
    Jun 3, 2005
  5. Arnold Shore

    Converting a Byte Value to its Numeric Value

    Arnold Shore, Oct 9, 2003, in forum: ASP General
    Replies:
    0
    Views:
    133
    Arnold Shore
    Oct 9, 2003
Loading...

Share This Page