connection.Open();
string txtSql = "select EmployeeID, Lastname, FirstName, Title, TitleOfCourtesy, HireDate, Address, City, Homephone from Employees";
SqlCommand cmd = new SqlCommand(txtSql, connection);
SqlDataReader dr = cmd.ExecuteReader();
ListViewItem a;
while (dr.Read())
{
a = new ListViewItem();
for (int i=1; i < dr.FieldCount; i++)
{
a.Text = Convert.ToString(dr.GetValue(i));
ListViewItem.ListViewSubItem bla = new ListViewItem.ListViewSubItem(a, a.Text.ToString());
a.SubItems.Add(bla);
}
Bookmarks