SQLiteConnection conn = new SQLiteConnection(@"data source=...\Debug\bazaa.s3db"); conn.Open(); SQLiteCommand cmd = new SQLiteCommand(" Select * from korisnici", conn); DataSet1 dt = new DataSet1(); SQLiteDataAdapter da = new SQLiteDataAdapter(cmd); DataTable tbl = new DataTable(); da.Fill(tbl); // fill the listview with values listView1.DataContext = tbl; conn.Close();
public class konekcija { ListView zomg = new ListView(); // this list view will be copied onto another class public void konektujme() { SQLiteConnection conn = new SQLiteConnection(@"data source=...\Debug\bazaa.s3db"); conn.Open(); SQLiteCommand cmd = new SQLiteCommand(" Select * from korisnici", conn); DataSet1 dt = new DataSet1(); SQLiteDataAdapter da = new SQLiteDataAdapter(cmd); DataTable tbl = new DataTable(); da.Fill(tbl); //listView1.DataContext = tbl; zomg.DataContext = tbl; elementi.transfer.DataContext = zomg.DataContext; conn.Close(); }
static public class elementi { static public ListView transfer = new ListView(); }
konekcija jao = new konekcija(); jao.konektujme(); listView1.DataContext = elementi.transfer;