想让DataGridView只显示出查询结果应该怎样做? 查询完成后,DataGridView上显示出了想查询的内容,再进行下一次查询时让DataGridView只显示出这一次新查询出来的结果,这个应该怎样做啊 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 DataGridView.DataBind()每次邦定都都要加这个! DataGridView.DataSource = DataTable;DataGridView.DataBind(); 查询一次,绑定一次,如下: //dataGridView 数据源已绑定 this.bindingSource protected virtual void SetDataSource(string strSql, string strWhere, string strOrder, bool isFirstLoad) { if (m_BLLCommon == null) return; this.dataSet = m_BLLCommon.GetDataSet(strSql, strWhere, strOrder, isFirstLoad); this.bindingSource.DataSource = this.dataSet.Tables[0].DefaultView; this.bindingSource_PositionChanged(null, null); } DataGridView.DataSource重新设置一下就行了。要注意数据源应该使用New新建立一个,否则可能会把上一次的数据合并起来。比如DataSet会自动的合并原来的数据。 .net信息添加不成功!求高手指点 求动态数组实例 文件下载:中文文件名称长度限制以及直接打开时文件名称出现乱码解决方案 高手来啊~~C#如何获得word文档中字体颜色的属性(在线等~~急~~) C#中如何用鼠标拖动随意移动窗体 关于调用WebServices的一个问题。 请教大家一个算法. 导出excel 保存在桌面时出错 请问怎样取得当前DataGrid中所有的数据写入2维数组的问题!!急,在线~ 这样的TextBox如何实现? 请教如何在C.net中返回xml串?谢谢! 在C#Form中怎么样显示pdf?高手救命
DataGridView.DataBind();
protected virtual void SetDataSource(string strSql, string strWhere, string strOrder, bool isFirstLoad)
{
if (m_BLLCommon == null) return; this.dataSet = m_BLLCommon.GetDataSet(strSql, strWhere, strOrder, isFirstLoad);
this.bindingSource.DataSource = this.dataSet.Tables[0].DefaultView;
this.bindingSource_PositionChanged(null, null);
}