本文整理汇总了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,