Example #1
0
        private List<short_entity> GetShortEntities(string query)
        {
            List<short_entity> list_entities = new List<short_entity>();

            if (OpenConnection())
            {
                using (MySqlCommand cmd = new MySqlCommand(query, connection))
                {
                    MySqlDataReader dataReader = cmd.ExecuteReader();
                    if (dataReader.HasRows)
                    {
                        while (dataReader.Read())
                        {
                            short_entity e = new short_entity()
                            {
                                uid = dataReader.GetUInt32(0),
                                name = dataReader.IsDBNull(1) ? null : dataReader.GetString(1),
                                description = dataReader.IsDBNull(2) ? null : dataReader.GetString(2)
                            };
                            list_entities.Add(e);
                        }
                    }
                    dataReader.Close();
                }
                this.CloseConnection();
            }
            return list_entities;
        }
Example #2
0
 private short_entity GetShortEntity(string query)
 {
     var new_short_entity = new short_entity();
     if (OpenConnection())
     {
         using (MySqlCommand cmd = new MySqlCommand(query, connection))
         {
             MySqlDataReader dataReader = cmd.ExecuteReader();
             if (dataReader.HasRows)
             {
                 while (dataReader.Read())
                 {
                     new_short_entity = new short_entity()
                     {
                         uid = dataReader.GetUInt32(0),
                         name = dataReader.IsDBNull(1) ? null : dataReader.GetString(1),
                         description = dataReader.IsDBNull(2) ? null : dataReader.GetString(2)
                     };
                 }
             }
             dataReader.Close();
         }
         this.CloseConnection();
     }
     return new_short_entity;
 }