将DataTable中满足条件的记录输入到另一个DataTable
来源:互联网 发布:双色球关注数据采集 编辑:程序博客网 时间:2024/05/16 13:51
private DataTable GetNewDataTable(DataTable dt,string condition)
{
DataTable newdt = new DataTable();
newdt=dt.Clone();
DataRow[] dr = dt.Select(condition);
for(int i=0;i<dr.Length;i++)
{
newdt.ImportRow((DataRow)dr[i]);
}
return newdt;//返回的查询结果
}
调用:
string strFilter = string.Empty;
strFilter = " " + strID + " like '%" + textBox1.Text + "%' or " + strName + " like '%" + textBox1.Text + "%' ";
DataTable dtDes = GetNewDataTable(dtSrc, strFilter);
bindingSource2.DataSource = dtDes;
dataGridView2.DataSource = bindingSource2;
- 将DataTable中满足条件的记录输入到另一个DataTable
- C#如何将一个DataTable中满足条件的数据导入另一个DataTable
- C#如何将一个DataTable中满足条件的数据导入另一个DataTable
- 将datatable里符合条件的记录取出添加到另一个datatable进行数据绑定!
- 将DataTable一行放入另一个DataTable中
- 复制表数据——把一个dataTable中符合条件的信息添加到另一个新的DataTable中
- 将DataTable中的一行复制到另一个DataTable
- 将DataTable中的某一行复制到另一个新的DataTable
- DataTable中执行DataTable.Select("条件")返回DataTable的方法
- DataTable中数据复制到另一个DataTable中
- 【转载】如何从一个DataTable中添加到属于另一个DataTable的 DataRow
- DataRow[]数组加入到另一个DataTable中
- .net 复制DataTable 里面的Row到另一个DataTable
- 复制datatable的行到另一个DT
- 复制DataTabe的Rows到另一个DataTable
- 怎样向DataTable中添加属于另一个DataTable的DataRow
- C# 将 DataTable t1 内容复制到 DataTable t2中
- 克隆datatable,并将数据也克隆到datatable中
- 取消按回車后就响应Button事件的JavaScript
- 深入浅出Http
- IMPLEMENT_DYNCREATE
- MySQL开发中的外键(foreign key)与参照完整性(Referential integrity)
- 用DriverStudio开发USB驱动程序[图]
- 将DataTable中满足条件的记录输入到另一个DataTable
- Eclipse快捷键大全(转载)
- 提高PHP编程效率的53个要点
- Prevent ASP.NET web.config inheritance, and inheritInChildApplications attribute -ASP.NET如何防止web.config向下(子应用程序)继承?
- Android学习1——SDK文档阅读
- Java从入门到精通 - 数据库操作-PrepareStatementTest
- SQL Server2005中得到所有表的字段及其他信息
- office11 的引用被指向了 office12
- 在tomcat中实现https安全连接的方法