想让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会自动的合并原来的数据。 textbox框中的内容满了之后,再有添加数据时添加一个数据相应的最早的数据出去一个 sql 急求C#解答。 C#中excel单元格合并问题 验证必须输入数字得区别 自己的机子始终连接不上服务器上的SQL? 什么控件能代替DriveListBoxt和DirListBox组合? 如何用 MSNPSharp 实现向任意一个MSN用户发信息 请问一下有哪些方法从一个ds的表中读取值 【求教】USB通信编程 请教如何在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);
}