标签:
var query = Code.ProductDataManage.Instance.GetLamadaQuery(); //添加引用CRL query = query.Select(b=>b.SelectField(b.InterFaceUser,b.ProductName,b.PurchasePrice));//选择查询的字段 query = query.Top(10);//取多少条 query = query.Where(b => b.Id < 700 && b.InterFaceUser == "USER1");//查询条件 query = query.OrderBy(b => b.Id, true);//排序条件 var list = Code.ProductDataManage.Instance.QueryList(query);
//创建分页存储过程sp_TablesPageNew.sql int page = 1; int pageSize = 15; int count; CRL.ParameCollection c = new CRL.ParameCollection(); string where = " InterFaceUser=‘test‘";//按标准 SQL 进行拼接 c.SetQueryCondition(where); c.SetQueryPageIndex((int)page); c.SetQueryPageSize(pageSize); var list = Code.ProductDataManage.Instance.QueryListByPage(c, out count);
//此方法演示根据结果集返回动态对象 string sql = "select top 10 Id,ProductId,ProductName from ProductData"; var helper = dbHelper; var list = helper.ExecDynamicList(sql); //添加引用 Miscorsoft.CSharp程序集 foreach(dynamic item in list) { var id = item.Id; var productId = item.ProductId; }
//按条件id>0,合计Number列 var sum = Code.ProductDataManage.Instance.Sum(b => b.Id > 0, "Number"); //按条件id>0,进行总计 var count = Code.ProductDataManage.Instance.Count(b => b.Id > 0);
标签:
原文地址:http://www.cnblogs.com/hubro/p/4286233.html