this.listView1.GridLines = true
this.listView1.FullRowSelect=true;
this.listView1.View = View.Details;
this.listView1.Scrollable = true; this.listView1.MultiSelect = false;
this.listView1.HeaderStyle = ColumnHeaderStyle.Nonclickable;
this.listView1.LabelEdit = true;
this.listView1.TabIndex = 0;
this.listView1.Columns.Add("学号", 100, HorizontalAlignment.Right);
this.listView1.Columns.Add("姓名", 100, HorizontalAlignment.Left);
this.listView1.Columns.Add("年龄", 100, HorizontalAlignment.Left);
this.listView1.Visible = true;//初始化
SqlCommand selcmd1 = new SqlCommand();
selcmd1 = conn.CreateCommand();
selcmd1.CommandText = "select * from student where stuID like '%"+txtID.Text+"%'";
SqlDataReader reade1;
reade1 = selcmd1.ExecuteReader();
while (reade1.Read())
{
ListViewItem Li1 = new ListViewItem();
Li1.SubItems.Clear();
Li1.SubItems[0].Text = reade1["stuID"].ToString();
Li1.SubItems.Add(reade1["stuName"].ToString());
Li1.SubItems.Add(reade1["age"].ToString());
this.listView1.Items.Add(Li1);
}
reade1.Close();