在DataTable中執(zhí)行Select("條件")后,返回DataTable的方法
更新時間:2007年09月10日 21:42:53 作者:
網(wǎng)上看到一個解決方法,感覺不錯:
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; //返回的查詢結果
}
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; //返回的查詢結果
}
相關文章
Asp.Net其他頁面如何調(diào)用Web用戶控件寫的分頁
這篇文章主要介紹了Asp.Net其他頁面如何調(diào)用Web用戶控件寫的分頁,需要的朋友可以參考下2014-05-05
asp.net基于替換模版頁的形式生成靜態(tài)頁的方法
這篇文章主要介紹了asp.net基于替換模版頁的形式生成靜態(tài)頁的方法,涉及asp.net模板的設置、變量替換、配置文件設置與讀取、以及文件夾與靜態(tài)文件的創(chuàng)建等技巧,需要的朋友可以參考下2016-07-07
asp.net DataGridView導出到Excel的三個方法[親測]
打開Excel并將DataGridView控件中數(shù)據(jù)導出到Excel的幾種方法2008-08-08

