Where is SqliteDataReader in sqlite-net?
Asked Answered
E

2

7

I'm trying to port an iOS application that uses native Sqlite3 and makes heavy use of SqliteDataReader. On the target platform I use SQLIte-Net (https://github.com/praeclarum/sqlite-net) and there the SqliteDataReader class does not exist. What are my best options to convert this? The usage of the reader is always code like this:

SqliteConnection oConn = AppDelegateBase.MasterDatabase.CreateDBMSConnection();
using ( SqliteCommand oCmd = new SqliteCommand ( "SELECT * FROM ATable"), oConn ) )
using ( var oReader = oCmd.ExecuteReader (  ) )
{
  while ( oReader.Read (  ) )
  {
    int val = Convert.ToInt32(oReader["someColumn"]);
  }
  oReader.Close ();
}
Epinasty answered 24/8, 2012 at 15:34 Comment(4)
Why do you want the DataReader class separately? The code you posted works very well. The oReader is your IDbDataReader object. Better use the ADO.NET version posted by tHandSnailfish
And you dont need the reader.Close when you are wrapping it in a using clauseSnailfish
I'min the same boat - just posted a query on SO with a further explanation of what I'm trying to do - did you solve your issue? #21490926Plow
No, never solved it. However your question does not seem to be about Sqlie.Net (the ORM) but about Sqlite in general.Epinasty
C
2

There is no IDataReader/IDataRecord implementation in sqlite-net, because sqlite-net is not ADO adapter .net implementation.

You should check examples on GitHub page first. You should not use SQL language, like described here. If you need ADO imlementation, there are other SQLite libraries for C#, like System.Data.SQLite (official), sqlite-csharp and Mono.Data.Sqlite.

Competition answered 18/10, 2014 at 10:38 Comment(0)
T
2

Ive used the System.Data.SQLite ADO adapter successfully in a few projects. I believe it has an a SQLDataReader class. Im not sure if its that same implementation you are after however.

Tophole answered 22/10, 2012 at 12:46 Comment(0)
C
2

There is no IDataReader/IDataRecord implementation in sqlite-net, because sqlite-net is not ADO adapter .net implementation.

You should check examples on GitHub page first. You should not use SQL language, like described here. If you need ADO imlementation, there are other SQLite libraries for C#, like System.Data.SQLite (official), sqlite-csharp and Mono.Data.Sqlite.

Competition answered 18/10, 2014 at 10:38 Comment(0)

© 2022 - 2024 — McMap. All rights reserved.