Beispiel #1
0
        public void latvanyossagListaz()
        {
            listLatvanyossag.Items.Clear();
            var command = conn.CreateCommand();
            var varosok = (varosok)listVaros.SelectedItem;

            if (varosok != null)
            {
                command.CommandText = @"SELECT id,nev,leiras,ar,varos_id FROM latvanyossagok
                                                    WHERE varos_id = " + varosok.Id;
                using (var reader = command.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 varos_id     = reader.GetInt32("varos_id");
                        var latvanyossag = new latvanyossagok(id, nev, leiras, ar, varos_id);

                        listLatvanyossag.Items.Add(latvanyossag);
                    }
                }
            }
        }
Beispiel #2
0
        void kivalaszthatoVarosokListazasa(int varosid)
        {
            listBoxLatvanyossagok.Items.Clear();

            var cmd = conn.CreateCommand();

            cmd.CommandText = "SELECT id, nev, leiras, ar, varos_id FROM latvanyossagok LEFT JOIN varosok ON latvanyossagok.varos_id = varosok.id WHERE varos_id = @varos_id";
            cmd.Parameters.AddWithValue("@varos_id", varosid);
            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 varos_id = reader.GetInt32("varos_id");
                    var varoska  = new latvanyossagok(id, nev, leiras, ar, varos_id);
                    listBoxLatvanyossagok.Items.Add(varoska);
                }
            }
        }
        private void latvanyossagListaz()
        {
            latvanyossagLista.Items.Clear();
            var cmd = conn.CreateCommand();

            cmd.CommandText = @"SELECT id,nev,leiras,ar,varos_id FROM latvanyossagok WHERE varos_id=@varos_id ORDER BY nev";
            var varos = (Varosok)varosLista.SelectedItem;

            cmd.Parameters.AddWithValue("@varos_id", varos.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 varos_id = reader.GetInt32("varos_id");

                    var latvanyossagok = new latvanyossagok(id, nev, leiras, ar, varos_id);
                    latvanyossagLista.Items.Add(latvanyossagok);
                }
            }
        }