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(); }
            }

    其中代码片段。

  • 相关阅读:
    BitTorrent源代码分析
    获取网卡网络流量
    获取进程cpu占用
    Python中的下划线命名规则
    python的内建函数isinstance
    python类
    内建函数print(python3.0)
    小象增强学习课件DQN网络和Q-learning
    11月深度学习班第5课风格变化NeuralStyle
    11月深度学习班第5课图像物体检测:rcnn/fast-rcnn/faster-rcnn
  • 原文地址:https://www.cnblogs.com/drek_blog/p/1709939.html
Copyright © 2011-2022 走看看