コード例 #1
0
        public override List <Pastagem> selectEverything()
        {
            var        tempList = new List <Pastagem>();
            string     sql      = $"select p.id, p.nome,p.areautil, p.IDTipoPastagem, tp.Nome from pastagem p  inner join tipoPastagem tp on p.IDTipoPastagem = tp.id-1;";
            Maquinario temp     = null;

            using (var c = new SQLiteConnection(connection))
            {
                c.Open();
                using (var cmd = new SQLiteCommand(sql, c))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            tempList.Add(new Pastagem(reader.GetInt32(0), reader.GetString(1), reader.GetFloat(2), reader.GetInt32(3), reader.GetString(4)));
                        }
                    }
                }
            }
            return(tempList);
        }
コード例 #2
0
        public override List <TipoPastagem> selectEverything()
        {
            var        tempList = new List <TipoPastagem>();
            string     sql      = $"select id, nome from tipoPastagem;";
            Maquinario temp     = null;

            using (var c = new SQLiteConnection(connection))
            {
                c.Open();
                using (var cmd = new SQLiteCommand(sql, c))
                {
                    using (var reader = cmd.ExecuteReader())
                    {
                        while (reader.Read())
                        {
                            tempList.Add(new TipoPastagem(reader.GetInt32(0), reader.GetString(1)));
                        }
                    }
                }
            }
            return(tempList);
        }