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

    其中代码片段。

  • 相关阅读:
    java面向对象
    Mysql 用户管理
    Mysql备份数据库
    Java方法&面向对象习题
    Mysql 用户管理
    java 方法笔记
    事物与存储过程
    多表操作
    视图 sql语句
    mongodb
  • 原文地址:https://www.cnblogs.com/drek_blog/p/1709939.html
Copyright © 2011-2022 走看看