Hi!
I have some problems with a listview.
I try to fill a listview with the SQLDataReader. Thas works but when i run my app the listview is emty
Here is my code
private void List_Films()
{
string ConnectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DVDFilmer;Data Source=TYRONNE;";
string SQL ="Select * from Filmer";
SqlConnection con = new SqlConnection(ConnectionString);
SqlCommand cmd = new SqlCommand(SQL,con);
con.Open();
SqlDataReader rst;
rst = cmd.ExecuteReader();
while (rst.Read())
{
ListViewItem item1 = new ListViewItem(rst["Filmid"].ToString(),0);
item1.SubItems.Add(rst["Film"].ToString());
item1.SubItems.Add(rst["Datum"].ToString());
item1.SubItems.Add(rst["Kategori"].ToString());
item1.SubItems.Add(rst["Utlanad"].ToString());
item1.SubItems.Add(rst["Den"].ToString());
}
con.Close();
}
Whats wrong?
/Tyson