方法为:

 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;//返回的查询结果
    }

 

 

调用的方法如下:

 

);
        GridView.DataBind();


//payment.GetPayment().Tables[0]为数据库检索出来的数据集
//State是一个字段名
//可写多个条件,用and,or连接

相关文章:

  • 2021-05-06
  • 2022-12-23
  • 2022-02-02
  • 2022-12-23
  • 2021-04-01
  • 2022-12-23
  • 2022-12-23
猜你喜欢
  • 2022-12-23
  • 2021-08-25
  • 2022-12-23
  • 2022-12-23
  • 2021-09-16
  • 2021-06-24
  • 2021-10-05
相关资源
相似解决方案