dataGridView 显示数据 定位到首记录 定位到未记录的方法
2009-12-02 09:52
330 查看
显示数据
conn = new SqlConnection("server=localhost;database=TXL;uid=sa;pwd=");
SqlDataAdapter sda = new SqlDataAdapter("select 姓名,关系,地址,E_mail,邮编,手机号,QQ,电话0,电话H from TXL", conn);
DataSet ds = new DataSet();
sda.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
在dataGridView中定位到首记录
this.dataGridView1.CurrentCell = this.dataGridView1[this.dataGridView1.CurrentCell.ColumnIndex,0];
在dataGridView中定位到末记录
this.dataGridView1.CurrentCell = this.dataGridView1[this.dataGridView1.CurrentCell.ColumnIndex, dataGridView1.RowCount-1];
conn = new SqlConnection("server=localhost;database=TXL;uid=sa;pwd=");
SqlDataAdapter sda = new SqlDataAdapter("select 姓名,关系,地址,E_mail,邮编,手机号,QQ,电话0,电话H from TXL", conn);
DataSet ds = new DataSet();
sda.Fill(ds);
dataGridView1.DataSource = ds.Tables[0];
在dataGridView中定位到首记录
this.dataGridView1.CurrentCell = this.dataGridView1[this.dataGridView1.CurrentCell.ColumnIndex,0];
在dataGridView中定位到末记录
this.dataGridView1.CurrentCell = this.dataGridView1[this.dataGridView1.CurrentCell.ColumnIndex, dataGridView1.RowCount-1];
相关文章推荐
- 关于EasyUI 1.5版Datagrid组件在空数据时无法显示"空记录"提示的BUG解决方法
- DataGridView显示数据之方法一
- discuz学习记录:使用C::t方法显示数据表内容
- DataGridView显示数据的两种方法
- asp.net Repeater控件用法----一列数据在Repeater中每行显示固定记录方法
- DataGridView显示数据的两种方法
- 【工作记录0013】easyui中datagrid绑定,后台可读出数据,前台未显示的解决方法
- ACCESS删除datagridview和数据库中的一条数据,同时更新显示的方法源码
- datagridview中显示的数据导出到Excel——用最简单的方法解决科学计数法的问题
- 【库房】查询无数据时如何显示——没有相关记录!
- PHP实现格式化文件数据大小显示的方法
- datagridview (三)DataGridViewComboBoxColumn 列或者DataGridViewComboBoxCell 赋值绑定数据的方法
- Android之内置和外置sdcard路径显示并且写入数据的方法
- Visual C# 2005 - 如何于DataGridView控件中以跨数据行方式显示数据
- 几种显示数据的方法的比较
- LCD 显示异常定位分析方法
- Oracle查询重复数据与删除重复记录方法
- Oracle删除重复记录只保留一条数据的几种方法
- jsp数据显示方法
- 关于Asp.net中GridView控件不显示部分列数据的方法