Exemplo n.º 1
0
        public static void Dodaj(KapetanBroda a)
        {
            SQLiteCommand c = Bazapodataka.con.CreateCommand();

            c.CommandText = String.Format(@"INSERT INTO KapetanBroda (ime, prezime, sifra, oib)
                    VALUES ('{0}', '{1}', '{2}', '{3}' )", a.Ime, a.Prezime, a.Sifra, a.Oib);

            c.ExecuteNonQuery();
            c.Dispose();
        }
Exemplo n.º 2
0
        public static List <KapetanBroda> DohvatiSveKB()
        {
            List <KapetanBroda> listKB = new List <KapetanBroda>();
            SQLiteCommand       c      = Bazapodataka.con.CreateCommand();

            c.CommandText = "SELECT id, ime, oib FROM KapetanBroda";

            SQLiteDataReader reader = c.ExecuteReader();

            while (reader.Read())
            {
                KapetanBroda k = new KapetanBroda();
                k.id  = (long)reader["id"];
                k.Ime = (string)reader["ime"];
                k.Oib = (string)reader["oib"];
                listKB.Add(k);
            }

            reader.Dispose();
            c.Dispose();

            return(listKB);
        }