Ejemplo n.º 1
0
        private void latvanyossagHozzaadAdatbazishoz(string nev, string leiras, int ar, int varos_id)
        {
            string sql  = @"INSERT INTO latvanyossagok (nev,leiras, ar,varos_id) VALUES ('" + nev + "','" + leiras + "'," + ar + ",'" + varos_id + "');";
            var    comm = conn.CreateCommand();

            comm.CommandText = sql;
            using (var mentes = comm.ExecuteReader());
            string value = varosokLstBx.SelectedItem.ToString();

            string[] adatok = value.Split(' ');
            string   nev1   = adatok[0];

            if (GetID(nev1) == varos_id)
            {
                Latvanyossag l1 = new Latvanyossag(nev, leiras, ar, varos_id);
                latvanyossagokLstBx.Items.Add(l1.ToString());
            }
        }
Ejemplo n.º 2
0
        private void latvanyossagokKiiratas()
        {
            latvanyossagokLstBx.Items.Clear();
            string value = varosokLstBx.SelectedItem.ToString();

            string[] adatok = value.Split(' ');
            string   nev    = adatok[0];
            string   sql    = @"SELECT nev, leiras, ar, varos_id FROM latvanyossagok WHERE varos_id =" + GetID(nev) + ";";
            var      comm   = conn.CreateCommand();

            comm.CommandText = sql;
            using (var mentes = comm.ExecuteReader())
            {
                while (mentes.Read())
                {
                    Latvanyossag l1 = new Latvanyossag(mentes.GetString("nev"), mentes.GetString("leiras"), mentes.GetInt32("ar"), mentes.GetInt32("varos_id"));
                    latvanyossagokLstBx.Items.Add(l1.ToString());
                }
            }
        }