﻿using System;
using System.Data;
using System.Data.SQLite;

namespace DataTable_konzola
{
    class DataTable_konzola
    {
        static void Main(string[] args)
        {
            DataSet ds;
            string povNiz = @"Data Source=E:\Baze\filmi.sqlite; Version=3;";


            SQLiteConnection povezava = new SQLiteConnection(povNiz);
            ds = new DataSet();

            SQLiteDataAdapter dataAdapter = new SQLiteDataAdapter("SELECT leto, naslov, reziser FROM Filmi"
                + " WHERE leto = 1962", povezava);
            dataAdapter.Fill(ds);
            DataTable tabela = ds.Tables[0];
            foreach (DataRow row in tabela.Rows)
            {
                Console.WriteLine("Leto: " + row.Field<string>(2) + "\t\t\t   :   Naslov: " + row.Field<string>(1));
            }
            // še en izpis
            Display(tabela);
        }

        static void Display(DataTable table)
        {
            Console.WriteLine("::TABELA::");
            foreach (DataRow row in table.Rows)
            {
                Console.WriteLine("ROW: {0}", string.Join(",", row.ItemArray));
            }
        }
    }
}

