方法为:
{
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;//返回的查询结果
}
调用的方法如下:
GridView.DataBind();
//payment.GetPayment().Tables[0]为数据库检索出来的数据集
//State是一个字段名
//可写多个条件,用and,or连接