简体   繁体   English

sqlite-net中的SqliteDataReader在哪里?

[英]Where is SqliteDataReader in sqlite-net?

I'm trying to port an iOS application that uses native Sqlite3 and makes heavy use of SqliteDataReader . 我正在尝试移植使用本机Sqlite3的iOS应用程序并大量使用SqliteDataReader On the target platform I use SQLIte-Net ( https://github.com/praeclarum/sqlite-net ) and there the SqliteDataReader class does not exist. 在目标平台上,我使用SQLIte-Net( https://github.com/praeclarum/sqlite-net ),并且SqliteDataReader类不存在。 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 ();
}

Ive used the System.Data.SQLite ADO adapter successfully in a few projects. 我已经在一些项目中成功使用了System.Data.SQLite ADO适配器。 I believe it has an a SQLDataReader class. 我相信它有一个SQLDataReader类。 Im not sure if its that same implementation you are after however. 我不确定你是否会使用相同的实现方式。

There is no IDataReader/IDataRecord implementation in sqlite-net, because sqlite-net is not ADO adapter .net implementation. sqlite-net中没有IDataReader / IDataRecord实现,因为sqlite-net不是ADO适配器.net实现。

You should check examples on GitHub page first. 您应首先检查GitHub页面上的示例。 You should not use SQL language, like described here . 你不应该使用SQL语言,如描述在这里 If you need ADO imlementation, there are other SQLite libraries for C#, like System.Data.SQLite (official), sqlite-csharp and Mono.Data.Sqlite. 如果需要ADO实现,还有其他适用于C#的SQLite库,如System.Data.SQLite(官方),sqlite-csharp和Mono.Data.Sqlite。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM