Fill a Listview with the SQLdatareader
Hi!
I need help with a listview..
My Question is how do i fill a listview with the SQLDataReader
I have gor so far as this
Code:
string ConnectionString="Integrated Security=SSPI;Persist Security Info=False;Initial Catalog=DVDFilmer;Data Source=TYRONNE;";
string SQL ="Select * from Film";
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("Ett",0);
item1.SubItems.Add("2");
item1.SubItems.Add("3");
}
con.Close();
So how do i add the Values from the reader into the listview.
regards!
Tyson