public Geomon ReadGeomon(string Name) { Geomon g = null; using (SqlConnection conn = new SqlConnection(DbConnection.connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand("spReadGeomon", conn); cmd.CommandType = CommandType.StoredProcedure; cmd.Parameters.AddWithValue("@Name", Name); try { SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { int id = (int)reader[0]; string name = (string)reader[1]; int rarity = (int)reader[2]; string type = (string)reader[3]; string image = (string)reader[4]; int level = (int)reader[5]; int evo = (int)reader[6]; g = new Geomon(id, name, rarity, type, image, level, evo); } } catch { } } return(g); }
public Geomon[] ReturnGeomons() { Geomon g = null; Geomon[] geoList = null; int i = 0; using (SqlConnection conn = new SqlConnection(DbConnection.connectionString)) { conn.Open(); SqlCommand cmd = new SqlCommand("spReadAllGeomon", conn); try { SqlDataReader reader = cmd.ExecuteReader(); while (reader.Read()) { int id = (int)reader[0]; string name = (string)reader[1]; int rarity = (int)reader[2]; string type = (string)reader[3]; string image = (string)reader[4]; int level = (int)reader[5]; int evo = (int)reader[6]; g = new Geomon(id, name, rarity, type, image, level, evo); geoList[i++] = g; } } catch { } } return(geoList); }