in

System.Data.SQLite

An open source ADO.NET provider for the SQLite database engine

How to read int?

Last post 07-24-2006 9:16 AM by Zane. 2 replies.
Page 1 of 1 (3 items)
Sort Posts: Previous Next
  • 07-14-2006 6:45 AM

    • AlexDP
    • Top 150 Contributor
    • Joined on 06-15-2006
    • Ukraine, Dniepropetrovsk
    • Posts 9

    How to read int?

    I want to read int from sqLite.

    But it returns long on integer values.

    Should I just make conversion to short int

    int var = 0;

    var = (int) dr["variable"];

    Or there is another way?

  • 07-14-2006 7:53 AM In reply to

    Re: How to read int?

    That looks like a datareader ... so use dr.GetInt32(index) instead.  Calling the various GetXXX() functions on the DataReader is faster than using the [] array indexer too.

    Robert

     

     

  • 07-24-2006 9:16 AM In reply to

    • Zane
    • Top 75 Contributor
    • Joined on 03-28-2006
    • Ferrara, Italy
    • Posts 14

    Re: How to read int?

    Take a look at the wonderful static methods of the Convert class!
    Gianluigi "Zane" Zanettini - Responsabile Editoriale MegaLab.it
Page 1 of 1 (3 items)
Powered by Community Server (Commercial Edition), by Telligent Systems