Esempio n. 1
0
        public string VypisVeliciny(VelicinyManager velicinyManager)
        {
            velicinyManager.VelicinyList.Add(new Veliciny(10, "pepicek", "jde do", "Vpředminulém čase"));

            string stav = "";

            try
            {
                conn.Open();
                string          sql = "SELECT id, jmeno, znacka, jednotky FROM veliciny";
                MySqlCommand    cmd = new MySqlCommand(sql, conn);
                MySqlDataReader rdr = cmd.ExecuteReader();
                velicinyManager.VelicinyList.Add(new Veliciny(10, "pepicek", "jde do", "lesa"));
                while (rdr.Read())
                {
                    velicinyManager.VelicinyList.Add(new Veliciny((int)rdr[0], rdr[1].ToString(), rdr[2].ToString(), rdr[3].ToString()));

                    //Console.WriteLine(rdr[0] + " -- " + rdr[1]);
                    //Console.WriteLine(rdr[0]);
                }
                rdr.Close();
                stav = "Veličiny načteny do listu";
            }
            catch (Exception ex) { stav = ex.Message.ToString(); }
            conn.Close();
            velicinyManager.VelicinyList.Add(new Veliciny(10, "pepicek", "jde do", "Podruhé do lesa"));
            return(stav);
        }
Esempio n. 2
0
        public string VratVelicinyList(VelicinyManager velicinyManager)
        {
            Databaze databaze = new Databaze();

            VelicinyList.Add(new Veliciny(1, "nol", "m", "kk"));
            VelicinyList.Add(new Veliciny(2, "nol", "km", "kppp"));
            return(databaze.VypisVeliciny(velicinyManager));
        }