using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using DAL;
using SqlSugar;//注意引入命名空间
namespace Demo
{
public partial class Demo : System.Web.UI.Page
{
protected void Page_Load(object sender, EventArgs e)
{
//详细教程 http://www.cnblogs.com/sunkaixuan/p/4649904.html
using (var db = SugarDao.GetInstance())
{
var list= db.Queryable
GridView1.DataSource = list;
GridView1.DataBind();
//取10-20条
var page1 = db.Queryable
//Skip 跳过,takbe 拿
GridView2.DataSource = page1;
GridView2.DataBind();
//取10-20条
var page2 = db.Queryable
GridView2.DataSource = page2;//数据源
GridView2.DataBind();//绑定数据
//取20条数据的简化写法
var page3 = db.Queryable
GridView3.DataSource = page3;//数据源
GridView3.DataBind();//绑定数据
//查询条数
var count = db.Queryable
Console.WriteLine(count);
//从第二条之后取所有的
var skipw = db.Queryable
GridView4.DataSource = skipw;
GridView4.DataBind();
//取出前两条数据
var take = db.Queryable
GridView5.DataSource = take;
GridView5.DataBind();
//not like
var like = db.Queryable
GridView6.DataSource = like;
GridView6.DataBind();
//可以在lambda中使用tostring 和convert
var convert1 = db.Queryable
var convert2 = db.Queryable
var convert3 = db.Queryable
GridView7.DataSource = convert3;
GridView7.DataBind();
//支持字符串Where 让你解决,更复杂的查询
var student12 = db.Queryable
//var student12 = db.Queryable
GridView8.DataSource = student12;
GridView8.DataBind();
}
}
}
}