当前位置: 首页>>代码示例>>C#>>正文


C# SQLiteConnection.ExecuteReader方法代码示例

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


在下文中一共展示了SQLiteConnection.ExecuteReader方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Main


//.........这里部分代码省略.........
                    Family f;
                    if (nextOverrideIndex < overrideFamilies.Count && overrideFamilies[nextOverrideIndex].ID == familyId)
                    {
                        // An override exists in the table; use it.
                        f = overrideFamilies[nextOverrideIndex];
                        nextOverrideIndex++;
                    }
                    else
                    {
                        // No override exists so go with default:
                        // Basic male/female are the same species which is the one listed first.
                        // There is no baby species nor incense
                        // (Non-incense babies are considered basic in this system anyway.)
                        // Gender ratio comes from the basic species.
                        byte genderRatio = (byte)Convert.ToInt32(connVeekun.ExecuteScalar("SELECT gender_rate FROM pokemon_species WHERE id = @id", new SQLiteParameter("@id", basicSpeciesId)));
                        f = new Family(null, familyId, basicSpeciesId, basicSpeciesId, 0, 0, 0, genderRatio);
                    }
                    db.PokedexInsertFamily(f);
                    String basic = (f.BasicMaleID != f.BasicFemaleID) ?
                        String.Format(" {0}/{1}", f.BasicMaleID, f.BasicFemaleID) :
                        String.Format(" {0}", f.BasicMaleID);
                    String baby;
                    if (f.BabyMaleID != f.BabyFemaleID)
                        baby = String.Format(" {0}/{1} incense {2}", f.BabyMaleID, f.BabyFemaleID, f.IncenseID);
                    else
                        baby = (f.BabyMaleID == 0) ? "" :
                            String.Format(" {0} incense {1}", f.BabyMaleID, f.IncenseID);
                    String gender = (f.GenderRatio == 255) ? "genderless" :
                        String.Format("{0}% female", (float)f.GenderRatio * 12.5f);
                    Console.WriteLine("Inserted family {0}{1}{2} {3}", f.ID, basic, baby, gender);
                }

                // pkmncf_pokedex_pokemon
                SQLiteDataReader rdPokemon = (SQLiteDataReader)connVeekun.ExecuteReader("SELECT " +
                    "pokemon_species.id, " +
                    "(SELECT pokemon_species_names.name FROM pokemon_species_names WHERE pokemon_species_names.pokemon_species_id = pokemon_species.id AND local_language_id = 1) AS name_ja, " +
                    "(SELECT pokemon_species_names.name FROM pokemon_species_names WHERE pokemon_species_names.pokemon_species_id = pokemon_species.id AND local_language_id = 9) AS name_en, " +
                    "(SELECT pokemon_species_names.name FROM pokemon_species_names WHERE pokemon_species_names.pokemon_species_id = pokemon_species.id AND local_language_id = 5) AS name_fr, " +
                    "(SELECT pokemon_species_names.name FROM pokemon_species_names WHERE pokemon_species_names.pokemon_species_id = pokemon_species.id AND local_language_id = 8) AS name_it, " +
                    "(SELECT pokemon_species_names.name FROM pokemon_species_names WHERE pokemon_species_names.pokemon_species_id = pokemon_species.id AND local_language_id = 6) AS name_de, " +
                    "(SELECT pokemon_species_names.name FROM pokemon_species_names WHERE pokemon_species_names.pokemon_species_id = pokemon_species.id AND local_language_id = 7) AS name_es, " +
                    "(SELECT pokemon_species_names.name FROM pokemon_species_names WHERE pokemon_species_names.pokemon_species_id = pokemon_species.id AND local_language_id = 3) AS name_ko, " +
                    "growth_rate_id, gender_rate, " +
                    "(SELECT egg_group_id FROM pokemon_egg_groups WHERE species_id = pokemon_species.id ORDER BY egg_group_id LIMIT 1) AS egg_group_1, " +
                    "(SELECT egg_group_id FROM pokemon_egg_groups WHERE species_id = pokemon_species.id ORDER BY egg_group_id LIMIT 1, 1) AS egg_group_2, " +
                    "hatch_counter, has_gender_differences " +
                    "FROM pokemon_species " +
                    "ORDER BY pokemon_species.id");

                while (rdPokemon.Read())
                {
                    int id = Convert.ToInt32(rdPokemon["id"]);
                    byte growth_rate_id = Convert.ToByte(rdPokemon["growth_rate_id"]);
                    int gender_rate = Convert.ToInt32(rdPokemon["gender_rate"]);
                    byte egg_group_1 = Convert.ToByte(rdPokemon["egg_group_1"]);
                    byte egg_group_2 = 0;
                    if (!(rdPokemon["egg_group_2"] is DBNull)) egg_group_2 = Convert.ToByte(rdPokemon["egg_group_2"]);
                    int hatch_counter = Convert.ToInt32(rdPokemon["hatch_counter"]);
                    byte has_gender_differences = Convert.ToByte(rdPokemon["has_gender_differences"]);

                    // todo: Family ID
                    Species s = new Species(null, id,
                        familyMap[id],
                        GetLocalizedString(rdPokemon, "name_"),
                        (GrowthRates)growth_rate_id,
                        (byte)gender_rate,
开发者ID:henias,项目名称:pkmn-classic-framework,代码行数:67,代码来源:Program.cs


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