zoukankan      html  css  js  c++  java
  • 关于Linq to DataSet

    代码
      private PagedDataSource BindMethod(PagedDataSource pds, string keyword)
            {
                OthersTradeBo bo 
    = null;
                
    try
                {
                    bo 
    = new OthersTradeBo();
                    DataSet ds 
    = responseDataSet(bo);
                    DataTable dt 
    = ds.Tables[0];
                    
    //空白时候,搜索全部
                    if (string.IsNullOrEmpty(keyword))
                    {
                        DataView dv 
    = ds.Tables[0].DefaultView; 
                        pds.DataSource 
    = dv;//视图用于绑定到页面
                        _recordCount = ds.Tables[0].DefaultView.Count;
                    }
                    
    else
                    {
                        var temp 
    = from c in dt.AsEnumerable() where c.Field<String>("InformationTitle").Contains(keyword) select c;
                        
    //dt.AsEnumerable().Where(c => c.Field<String>("InformationTitle").Contains(keyword));  //另外的写法,效果一样
                        pds.DataSource = temp.AsDataView();
                        _recordCount 
    = temp.Count();
                    }
                    bindPageButtons(_recordCount, _pagesize);
                    
    return pds;
                }
                
    finally { if (bo != null)bo.Dispose(); }
            }

    其中代码片段。

  • 相关阅读:
    微软 软件的 一组堆成快捷键
    C#事件 的讲解
    软件缺陷分析的几种方法
    一个长三角人对深圳的看法 (转)
    一次LoadRunner的CPC考试经历
    测试是一门武功
    ORACLE的性能测试经验总结
    深圳测试协会第九次论坛在深圳举行
    10月28日参加了IBM的产品推介会
    什么是web安全性测试?
  • 原文地址:https://www.cnblogs.com/drek_blog/p/1709939.html
Copyright © 2011-2022 走看看