{
int j = 1;
listView1.Columns.Add("Stt");
listView1.Columns.Clear();
listView1.Items.Clear();
SqlDataReader reader = lop.Reader("select * from sinhvien");
for (int i = 0; i < reader.FieldCount; i++)
listView1.Columns.Add(reader.GetName(i),110);
listView1.FullRowSelect = true;
listView1.GridLines = true;
listView1.View = View.Details;
listView1.CheckBoxes = true;
while (reader.Read())
{
ListViewItem item = new ListViewItem(j.ToString());
item.SubItems.Add(reader.GetString(0));
item.SubItems.Add(reader.GetString(1));
item.SubItems.Add(reader.GetString(2));
item.SubItems.Add(reader.GetString(3));
item.SubItems.Add(reader.GetString(4));
item.SubItems.Add(reader.GetString(5));
listView1.Items.Add(item);
j++;
}
}
» Tin mới nhất:
» Các tin khác: