| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 698 人关注过本帖
标题:[求助]listView问题
取消只看楼主 加入收藏
zhanghy1028
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2007-3-6
收藏
 问题点数:0 回复次数:4 
[求助]listView问题
为什么运行的时候在ListView上会出现Default行???
搜索更多相关主题的帖子: listView 
2007-03-14 15:39
zhanghy1028
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2007-3-6
收藏
得分:0 
我不知道怎么截图,所以我不知道怎么说才好.
就是在要查询的数据上出现Default行
2007-03-15 09:23
zhanghy1028
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2007-3-6
收藏
得分:0 

比如:
ID号 姓名 年龄
Defaul
123 dg 12
156 fr 54

2007-03-15 09:48
zhanghy1028
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2007-3-6
收藏
得分:0 

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();

2007-03-15 10:25
zhanghy1028
Rank: 1
等 级:新手上路
帖 子:108
专家分:0
注 册:2007-3-6
收藏
得分:0 
估计代码没错吧!
2007-03-15 10:26
快速回复:[求助]listView问题
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.032708 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved