Exemplo n.º 1
0
        void VarosListazas()
        {
            varosok_lb.Items.Clear();
            var cmd = conn.CreateCommand();

            cmd.CommandText = (@"SELECT * 
                                 FROM varosok
                                 ORDER BY nev");
            using (var reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    var id       = reader.GetInt32("id");
                    var nev      = reader.GetString("nev");
                    var lakossag = reader.GetInt32("lakossag");
                    var varos    = new varos(id, nev, lakossag);
                    varosok_lb.Items.Add(varos);
                }
            }
        }
Exemplo n.º 2
0
        void LatvanyossagokLiztazas(varos v)
        {
            latvanyossag_lb.Items.Clear();
            var cmd = conn.CreateCommand();

            cmd.CommandText = (@"SELECT * 
                               FROM latvanyossagok
                               WHERE varos_id=@varos_id
                               ORDER BY nev");
            cmd.Parameters.AddWithValue("@varos_id", v.Id);
            using (var reader = cmd.ExecuteReader())
            {
                while (reader.Read())
                {
                    var id             = reader.GetInt32("id");
                    var nev            = reader.GetString("nev");
                    var leiras         = reader.GetString("leiras");
                    var ar             = reader.GetInt32("ar");
                    var latvanyossagok = new latvanyossag(id, nev, leiras, ar);
                    latvanyossag_lb.Items.Add(new latvanyossag(id, nev, leiras, ar));
                }
            }
        }