• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

C# SQLite.SQLiteDataReader类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了C#中System.Data.SQLite.SQLiteDataReader的典型用法代码示例。如果您正苦于以下问题:C# SQLiteDataReader类的具体用法?C# SQLiteDataReader怎么用?C# SQLiteDataReader使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



SQLiteDataReader类属于System.Data.SQLite命名空间,在下文中一共展示了SQLiteDataReader类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。

示例1: printToConsole

        public string printToConsole(SQLiteDataReader readerDB, int index)
        {
            if (readerDB.IsDBNull(index))
            {
                //return "NULL";
                return "";
            }
            else
            {
                String dataObject = readerDB.GetFieldType(index).ToString();
                switch (dataObject)
                {
                    case "System.Int32":
                        return readerDB.GetInt32(index).ToString();
                    case "System.DateTime":
                        DateTime date = readerDB.GetDateTime(index);
                        return Convert.ToString(date);
                    case "System.String":
                        return readerDB.GetString(index);
                    default:
                        return "Unknown";
                }
            }

        }
开发者ID:bootresha,项目名称:EroDatabase,代码行数:25,代码来源:EroDatabaseAdapter.cs


示例2: ExecuteQuery

        public string ExecuteQuery(string sql_query, SQLiteParameter[] parameters, out SQLiteDataReader reader)
        {
            string res = string.Empty;

            reader = null;

            _connection.Open();
            _command = _connection.CreateCommand();
            _command.CommandText = sql_query;

            if (parameters != null)
            {
                _command.Parameters.Clear();
                _command.Parameters.AddRange(parameters);
            }

            try
            {
                reader = _command.ExecuteReader(CommandBehavior.CloseConnection);
            }
            catch (Exception ex)
            {
                res = CreateExceptionMessage(ex);
            }

            return res;
        }
开发者ID:kongkong7,项目名称:AppDev,代码行数:27,代码来源:Database.cs


示例3: SetExtractor

 /* Returns a Set using a SQLiteDataReader and a dictionary mapping the attributes to a index.
  */
 private Set SetExtractor(SQLiteDataReader reader, Dictionary<string, int> attributeIndexDict)
 {
     return new Set(reader.GetInt32(attributeIndexDict["day"]), reader.GetInt32(attributeIndexDict["month"]), 
             reader.GetInt32(attributeIndexDict["year"]), reader.GetInt32(attributeIndexDict["setSeqNum"]),
             reader.GetInt32(attributeIndexDict["activityId"]), reader.GetDouble(attributeIndexDict["weight"]),
             reader.GetInt32(attributeIndexDict["secs"]), reader.GetInt32(attributeIndexDict["reps"]));
 }
开发者ID:danilind,项目名称:workoutlogger,代码行数:9,代码来源:DatabaseOperations.cs


示例4: AddExperimentGSMToExperimentFromDb

 /// <summary>Will add GSMs from db to the given Experiment</summary>
 /// <param name="experiment">Experiment to have its GSMs property updated</param>
 public static void AddExperimentGSMToExperimentFromDb(Experiment experiment, SQLiteDataReader reader)
 {
     ExperimentGSM gsm = new ExperimentGSM(reader["gsm_id"].ToString(), reader["gsm_value"].ToString());
     gsm.Id = Convert.ToInt32(reader["id"].ToString());
     gsm.ExperimentId = reader["experiment_id"].ToString();
     experiment.GSMs.Add(gsm);
 }
开发者ID:svileng,项目名称:itranscriptome,代码行数:9,代码来源:ExperimentGSMHelper.cs


示例5: DbChannel

    internal DbChannel(SignalSource source, SQLiteDataReader r, IDictionary<string, int> field, 
      DataRoot dataRoot, IDictionary<string,bool> encryptionInfo)
    {
      this.SignalSource = source;
      this.RecordIndex = r.GetInt32(field["channel_handle"]);

      this.Bits = r.GetInt32(field["list_bits"]);
      bool isTv = (Bits & BITS_Tv) != 0;
      bool isRadio = (Bits & BITS_Radio) != 0;
      bool isAnalog = (source & SignalSource.Analog) != 0;
      if (isAnalog && !isTv)
      {
        this.IsDeleted = true;
        return;
      }

      if (isTv) this.SignalSource |= SignalSource.Tv;
      if (isRadio) this.SignalSource |= SignalSource.Radio;
      this.Lock = (Bits & BITS_Locked) != 0;
      this.OldProgramNr = r.GetInt32(field["channel_number"]);
      this.Favorites = this.ParseFavorites(Bits);
      
      if (isAnalog)
        this.ReadAnalogData(r, field);
      else
        this.ReadDvbData(r, field, dataRoot, encryptionInfo);
    }
开发者ID:CIHANGIRCAN,项目名称:ChanSort,代码行数:27,代码来源:DbChannel.cs


示例6: ReadDvbData

 protected void ReadDvbData(SQLiteDataReader r, IDictionary<string, int> field, DataRoot dataRoot, 
   IDictionary<string, bool> encryptionInfo)
 {
   string longName, shortName;
   this.GetChannelNames(r.GetString(field["channel_label"]), out longName, out shortName);
   this.Name = longName;
   this.ShortName = shortName;
   this.RecordOrder = r.GetInt32(field["channel_order"]);
   this.FreqInMhz = (decimal)r.GetInt32(field["frequency"]) / 1000;
   int serviceType = r.GetInt32(field["dvb_service_type"]);
   this.ServiceType = serviceType;
   this.OriginalNetworkId = r.GetInt32(field["onid"]);
   this.TransportStreamId = r.GetInt32(field["tsid"]);
   this.ServiceId = r.GetInt32(field["sid"]);
   int bits = r.GetInt32(field["list_bits"]);
   this.Favorites = this.ParseFavorites(bits);
   if ((this.SignalSource & SignalSource.Sat) != 0)
   {
     int satId = r.GetInt32(field["sat_id"]);
     var sat = dataRoot.Satellites.TryGet(satId);
     if (sat != null)
     {
       this.Satellite = sat.Name;
       this.SatPosition = sat.OrbitalPosition;
       int tpId = satId * 1000000 + (int)this.FreqInMhz;
       var tp = dataRoot.Transponder.TryGet(tpId);
       if (tp != null)
       {
         this.SymbolRate = tp.SymbolRate;
       }
     }
   }
   this.Encrypted = encryptionInfo.TryGet(this.Uid);      
 }
开发者ID:CIHANGIRCAN,项目名称:ChanSort,代码行数:34,代码来源:DbChannel.cs


示例7: BuildUserStructure

 private Person BuildUserStructure(SQLiteDataReader reader)
 {
     string name = reader.GetString(0);
     string fullName = reader.GetString(1);
     long personId = reader.GetInt64(2);
     return new Person(name, fullName, personId);
 }
开发者ID:wtain,项目名称:FinCalc,代码行数:7,代码来源:UsersManager.cs


示例8: ActivityExtractor

 /* Returns a Activity using a SQLiteDataReader and a dictionary mapping the attributes to a index.
  */
 private Activity ActivityExtractor(SQLiteDataReader reader, Dictionary<string, int> attributeIndexDict)
 {
     return new Activity(reader.GetInt32(attributeIndexDict["activityId"]),
             reader.GetInt32(attributeIndexDict["seqNum"]), reader.GetString(attributeIndexDict["workoutName"]),
             reader.GetInt32(attributeIndexDict["numSets"]), reader.GetInt32(attributeIndexDict["workoutVersion"]),
             reader.GetString(attributeIndexDict["exerciseName"]), reader.GetInt32(attributeIndexDict["exerciseVersion"]));
 }
开发者ID:danilind,项目名称:workoutlogger,代码行数:9,代码来源:DatabaseOperations.cs


示例9: ResourceRecord

        public ResourceRecord(SQLiteDataReader rpReader)
        {
            Time = DateTimeUtil.FromUnixTime(Convert.ToUInt64(rpReader["time"])).LocalDateTime.ToString();

            Fuel = Convert.ToInt32(rpReader["fuel"]);
            FuelDifference = Convert.ToInt32(rpReader["fuel_diff"]);

            Bullet = Convert.ToInt32(rpReader["bullet"]);
            BulletDifference = Convert.ToInt32(rpReader["bullet_diff"]);

            Steel = Convert.ToInt32(rpReader["steel"]);
            SteelDifference = Convert.ToInt32(rpReader["steel_diff"]);

            Bauxite = Convert.ToInt32(rpReader["bauxite"]);
            BauxiteDifference = Convert.ToInt32(rpReader["bauxite_diff"]);

            InstantConstruction = Convert.ToInt32(rpReader["instant_construction"]);
            InstantConstructionDifference = Convert.ToInt32(rpReader["instant_construction_diff"]);

            Bucket = Convert.ToInt32(rpReader["bucket"]);
            BucketDifference = Convert.ToInt32(rpReader["bucket_diff"]);

            DevelopmentMaterial = Convert.ToInt32(rpReader["development_material"]);
            DevelopmentMaterialDifference = Convert.ToInt32(rpReader["development_material_diff"]);

            ImprovementMaterial = Convert.ToInt32(rpReader["improvement_material"]);
            ImprovementMaterialDifference = Convert.ToInt32(rpReader["improvement_material_diff"]);
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun-Fx4,代码行数:28,代码来源:ResourceRecord.cs


示例10: SortieRecord

        internal SortieRecord(SQLiteDataReader rpReader)
        {
            SortieID = Convert.ToInt64(rpReader["id"]);

            var rMapID = Convert.ToInt32(rpReader["map"]);
            Map = MapService.Instance.GetMasterInfo(rMapID);

            var rEventMapDifficulty = (EventMapDifficultyEnum)Convert.ToInt32(rpReader["difficulty"]);
            IsEventMap = rEventMapDifficulty != EventMapDifficultyEnum.None;
            if (IsEventMap)
                EventMapDifficulty = rEventMapDifficulty;

            Step = Convert.ToInt32(rpReader["step"]);
            Node = Convert.ToInt32(rpReader["node"]);
            NodeWikiID = MapService.Instance.GetNodeWikiID(rMapID, Node);

            EventType = (SortieEventType)Convert.ToInt32(rpReader["type"]);
            if (EventType == SortieEventType.NormalBattle)
                BattleType = (BattleType)Convert.ToInt32(rpReader["subtype"]);

            if (EventType == SortieEventType.NormalBattle || EventType == SortieEventType.BossBattle)
                Time = DateTimeUtil.FromUnixTime(Convert.ToUInt64(rpReader["extra_info"])).LocalDateTime.ToString();

            ID = Convert.ToInt64(rpReader["extra_info"]);

            Update(rpReader);
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun-Fx4,代码行数:27,代码来源:SortieRecord.cs


示例11: AddDatasetTableRowToExperimentFromDb

 /// <summary>Will add a DatasetTableRow from db to the given Experiment</summary>
 /// <param name="experiment">Experiment to have its GSMs property updated</param>
 public static void AddDatasetTableRowToExperimentFromDb(Experiment experiment, SQLiteDataReader reader)
 {
     DatasetTableRow dtr = new DatasetTableRow(reader["id_ref"].ToString(), reader["identifier"].ToString(), reader["value"].ToString());
     dtr.Id = Convert.ToInt32(reader["id"].ToString());
     dtr.ExperimentId = reader["experiment_id"].ToString();
     experiment.DatasetTable.Add(dtr);
 }
开发者ID:svileng,项目名称:itranscriptome,代码行数:9,代码来源:DatasetTableRowHelper.cs


示例12: Update

        internal void Update(SQLiteDataReader rpReader)
        {
            var rBattleRank = rpReader["rank"];
            if (rBattleRank != DBNull.Value)
            {
                BattleRank = (BattleRank)Convert.ToInt32(rBattleRank);
                OnPropertyChanged(nameof(BattleRank));
            }

            var rDroppedShip = rpReader["dropped_ship"];
            if (rDroppedShip != DBNull.Value)
            {
                DroppedShip = KanColleGame.Current.MasterInfo.Ships[Convert.ToInt32(rDroppedShip)];
                OnPropertyChanged(nameof(DroppedShip));
            }

            IsBattleDetailAvailable = Convert.ToBoolean(rpReader["battle_detail"]);
            OnPropertyChanged(nameof(IsBattleDetailAvailable));

            var rHeavilyDamagedShipIDs = rpReader["heavily_damaged"];
            if (rHeavilyDamagedShipIDs != DBNull.Value)
            {
                HeavilyDamagedShips = ((string)rpReader["heavily_damaged"]).Split(',').Select(r => KanColleGame.Current.MasterInfo.Ships[int.Parse(r)]).ToList();
                OnPropertyChanged(nameof(HeavilyDamagedShips));
            }
        }
开发者ID:amatukaze,项目名称:IntelligentNavalGun-Fx4,代码行数:26,代码来源:SortieRecord.cs


示例13: generateAllRelatedPreRequisites

        public static List<Course> generateAllRelatedPreRequisites(Course course)
        {
            List<Course> preRequisiteCourses = new List<Course>();
            String queryStatement = @"WITH RECURSIVE
              pre_req_courses(n) AS (
            VALUES('" + course.id + @"')
            UNION
            SELECT COURSEID FROM PreRequisite, pre_req_courses
             WHERE PreRequisite.FOLLOWID=pre_req_courses.n
              )
            SELECT COURSEID FROM PreRequisite
             WHERE PreRequisite.FOLLOWID IN pre_req_courses";

            try
            {
                dbConnection.Open();
                sqlCommand = new SQLiteCommand(queryStatement, dbConnection);
                dataReader = sqlCommand.ExecuteReader();

                while (dataReader.Read())
                {
                    String preReqCourseId = dataReader["COURSEID"].ToString();
                    String readPreReqCourse = "SELECT * FROM Course WHERE ID = '" + preReqCourseId + "'";

                    SQLiteCommand sqlCommandTemp = new SQLiteCommand(readPreReqCourse, dbConnection);
                    SQLiteDataReader dataReaderTemp = sqlCommandTemp.ExecuteReader();
                    Course preReq = null;
                    while (dataReaderTemp.Read())
                    {
                        preReq = new Course(dataReaderTemp["ID"].ToString(),
                                (int)dataReaderTemp["YR"],
                                (int)dataReaderTemp["SEM"],
                                dataReaderTemp["NAME"].ToString(),
                                dataReaderTemp["DESC"].ToString(),
                                (int)dataReaderTemp["POINTS"],
                                dataReaderTemp["ACADEMICORG"].ToString(),
                                dataReaderTemp["ACADEMICGROUP"].ToString(),
                                dataReaderTemp["COURSECOMP"].ToString(),
                                dataReaderTemp["GRADINGBASIS"].ToString(),
                                dataReaderTemp["TYPOFFERED"].ToString(),
                                dataReaderTemp["REMARKS"].ToString(),
                                dataReaderTemp["CAREERID"].ToString());
                    }
                    if (preReq != null)
                    {
                        Logger.Info("[DatabaseConnection::getPrerequisiteCourse()] PreRequisite Course Information:");
                        Logger.Info("[DatabaseConnection::getPrerequisiteCourse()]" + "\nID: " + preReq.id + "\nNAME: " + preReq.name + "\nDESC: " + preReq.description);
                        preRequisiteCourses.Add(preReq);
                    }
                }
                dbConnection.Close();
            }
            catch (Exception e)
            {
                Logger.Error("DatabaseConnection::generateAllRelatedPreRequisites() " + e.Message);
            }

            return preRequisiteCourses;
        }
开发者ID:ebaguia,项目名称:CareerPath,代码行数:59,代码来源:DatabaseConnection.cs


示例14: ToQuestion

 /// <summary>
 /// Преобразует ответ в "вопрос"
 /// </summary>
 /// <param name="reader">Ответ из БД</param>
 /// <returns>вопрос</returns>
 private Question ToQuestion(SQLiteDataReader reader)
 {
     Question question = new Question();
     question.ID = Convert.ToInt32(reader["ID"]);
     question.Value = Convert.ToString(reader["Value"]);
     question.Subject = new Subject(Convert.ToInt32(reader["Subject_ID"]));
     return question;
 }
开发者ID:simple-testing,项目名称:student-testing,代码行数:13,代码来源:QuestionDao.cs


示例15: Module

 public Module(SQLiteDataReader results)
 {
     this._id = results[idColumn] as Int64?;
     this._name = results[nameColumn] as String;
     this._code = results[codeColumn] as String;
     this._credits = results[creditsColumn] as Int64?;
     this._year = results[yearColumn] as Int64?;
 }
开发者ID:sambulosenda,项目名称:Classify,代码行数:8,代码来源:Module.cs


示例16: ToLexicon

 private static Lexicon ToLexicon(SQLiteDataReader reader)
 {
     var result = new Lexicon();
     result.Id = Convert.ToInt32(reader["id"].ToString());
     result.Word = reader["word"].ToString();
     result.Translator = reader["translator"].ToString();
     return result;
 }
开发者ID:shimitei,项目名称:UnstableCribs,代码行数:8,代码来源:DatabaseAction.cs


示例17: Assessment

 public Assessment(SQLiteDataReader results)
 {
     this._id = results[idColumn] as Int64?;
     this._title = results[titleColumn] as String;
     this._weight = results[weightColumn] as Int64?;
     this._type = results[typeColumn] as String;
     this._result = results[resultColumn] as Int64?;
 }
开发者ID:sambulosenda,项目名称:Classify,代码行数:8,代码来源:Assessment.cs


示例18: ReadUserInfo

        public List<UserInfo> ReadUserInfo()
        {
            // Create a list for the user info.
            List<UserInfo> listUserInfo = new List<UserInfo>();

            // Open the database.
            dbConnection.Open();

            // Retrieve all records from the table called "mailaddresses".
            dbCommand.CommandText = "SELECT * FROM mailaddresses;";

            // Execute the newly created command.
            dbQuery = dbCommand.ExecuteReader();

            // Read the retrieved query, and write the results to the newly created list.
            while (dbQuery.Read())
                listUserInfo.Add(new UserInfo
                {
                    userMail = dbQuery["address"].ToString(),
                    password = dbQuery["password"].ToString(),
                    autoLogin = dbQuery["autologin"].ToString()
                });

            // Close the query-reader again.
            dbQuery.Close();

            // Close the database again.
            dbConnection.Close();

            // Return the created list.
            return listUserInfo;
        }
开发者ID:Woodje,项目名称:MailClient,代码行数:32,代码来源:LoginDatabase.cs


示例19: selectData

        public void selectData(List<String> where1, List<String> where2, String tableName, String[] orderBy)
        {
            command.CommandText = "SELECT * from ";
            command.CommandText += tableName;
            if (where1.Count > 0)
            {
                command.CommandText += " WHERE";
                for (int i = 0; i < where1.Count; i++)
                {
                    command.CommandText += " " + where1.ElementAt(i) + "=" + where2.ElementAt(i) + " AND";
                }
                command.CommandText = command.CommandText.Substring(0, command.CommandText.Length - 3);
                where1.RemoveRange(0, where1.Count);
                where2.RemoveRange(0, where2.Count);
            }
            command.CommandText += " ORDER BY ";
            command.CommandText += orderBy;
            dataReader = command.ExecuteReader();

            while (dataReader.Read())
            {
                Console.WriteLine("ID           : " + DB_PrintToConsole(dataReader, 0) + " ");
                Console.WriteLine("Source Site  : " + DB_PrintToConsole(dataReader, 1) + " ");
                Console.WriteLine("Source ID    : " + DB_PrintToConsole(dataReader, 2) + " ");
                Console.WriteLine("Circle Name  : " + DB_PrintToConsole(dataReader, 3) + " ");
                Console.WriteLine("Date         : " + DB_PrintToConsole(dataReader, 4) + " ");
                Console.WriteLine("Title        : " + DB_PrintToConsole(dataReader, 5) + " ");
                Console.WriteLine("Title Altern : " + DB_PrintToConsole(dataReader, 6) + " ");
                Console.WriteLine("Language     : " + DB_PrintToConsole(dataReader, 7) + " ");
                Console.WriteLine("Data Type    : " + DB_PrintToConsole(dataReader, 8));
                Console.WriteLine();
            }
        }
开发者ID:bootresha,项目名称:EroDatabase,代码行数:33,代码来源:EroDatabaseAdapter.cs


示例20: GetIconName

        public string GetIconName(UInt16 RcpId)
        {
            string ret = "";
            try
            {
                _SQLiteConnection.Open();
                string qury = string.Format("select * from tb_recipe where ID={0}", RcpId);
                SQLiteCommand command = new SQLiteCommand(qury, _SQLiteConnection);
                _reader = command.ExecuteReader();
                while (_reader.Read())
                    ret = _reader["IconName"].ToString();
                Console.ReadLine();

            }
            catch (Exception e)
            {
                Console.WriteLine(e);

            }
            finally
            {
                _reader.Close();
                _SQLiteConnection.Close();

            }
            return ret;
        }
开发者ID:lee-icebow,项目名称:CREM.EVO,代码行数:27,代码来源:DataBaseHelp.cs



注:本文中的System.Data.SQLite.SQLiteDataReader类示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
C# SQLite.SQLiteParameter类代码示例发布时间:2022-05-26
下一篇:
C# SQLite.SQLiteDataAdapter类代码示例发布时间:2022-05-26
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap