1.以开头查

public List<Car> Select1(string a){

return con.Car.Where(r => r.Name.StartsWith(a)).ToList();
}

2.以结尾查

public List<Car> Select2(string a)

{
return con.Car.Where(r => r.Name.EndsWith(a)).ToList();
}

3.最大值

public string Max()

{
return con.Car.Max(r => r.Price).ToString();
}

4.最小值

public string Min()

{
return con.Car.Min(r => r.Price).ToString();
}

5.总和

public string Sum()
{
return con.Car.Sum(r => r.Price).ToString();
}

6.平均值

public string avg()
{
return con.Car.Average(r => r.Price).ToString();
}

7.升序

public List<Car> ss()
{
return con.Car.OrderBy( r =>r.Price).ToList();
}

8.降序

public List<Car> s()
{
return con.Car.OrderByDescending(r => r.Price).ToList();
}

9.组合分页查询

    public List<Car> Selecta(int d, string a, string b, string c)
{
List<Car> list = new List<Car>();
list = con.Car.ToList();
if (a != "")
{
List<Car> list1 = con.Car.Where(r => r.Code.Contains(a)).ToList(); list = list.Intersect(list1).ToList();
}
if (b != "")
{
List<Car> list1 = con.Car.Where(r => r.Name.Contains(b)).ToList(); list = list.Intersect(list1).ToList();
}
if (c != "")
{
List<Car> list1 = con.Car.Where(r => r.Brand.Contains(c)).ToList(); list = list.Intersect(list1).ToList();
}
return list.Skip((d-1-1) * PageCount).Take(PageCount).ToList(); } int PageCount = 6;
public List<Car> start()
{
return con.Car.Skip(0 * PageCount).Take(PageCount).ToList();
}
public List<Car> prev(string a)
{
return con.Car.Skip((Convert.ToInt32(a) - 1 - 1) * PageCount).Take(PageCount).ToList();
}
public List<Car> next(string a)
{
return con.Car.Skip(Convert.ToInt32(a) * PageCount).Take(PageCount).ToList();
}
public List<Car> end()
{
return con.Car.Skip((max() - 1) * PageCount).Take(PageCount).ToList();
} private int max()
{
int count = new CarData().Select().Count; double aa = count / (PageCount * 1.0); return Convert.ToInt32(Math.Ceiling(aa));
}
}

  

void LinkButton4_Click(object sender, EventArgs e)
{
Repeater1.DataSource = new CarData().end();
Repeater1.DataBind();
Label2.Text = max().ToString();
} private int max()
{
int count = new CarData().Select().Count; double aa = count / (PageCount * 1.0); return Convert.ToInt32(Math.Ceiling(aa));
}
void LinkButton3_Click(object sender, EventArgs e)
{
if (Convert.ToInt32(Label2.Text) < max())
{
int a = Convert.ToInt32(Label2.Text) + 1;
Repeater1.DataSource = new CarData().next(Label2.Text);
Repeater1.DataBind();
Label2.Text = a.ToString();
}
else
{
return;
} } void LinkButton2_Click(object sender, EventArgs e)
{ if (Convert.ToInt32(Label2.Text) > 1)
{
int a = Convert.ToInt32(Label2.Text) - 1;
Repeater1.DataSource = new CarData().prev(Label2.Text);
Repeater1.DataBind();
Label2.Text = a.ToString();
}
else
{
return;
}
} void LinkButton1_Click(object sender, EventArgs e)//首页
{
Repeater1.DataSource = new CarData().start();
Repeater1.DataBind();
Label2.Text = "1";
} void Button13_Click(object sender, EventArgs e)
{
Label2.Text = "1";
int a = Convert.ToInt32(Label2.Text) + 1;
Repeater1.DataSource = new CarData().Selecta(a,TextBox3.Text, TextBox4.Text, TextBox5.Text);
Repeater1.DataBind(); int count = new CarData().Select().Count; Label3.Text = Math.Ceiling(Convert.ToDouble(count) / PageCount).ToString(); }

  

LinkQ 组合查询与分页的更多相关文章

  1. Web 组合查询加 分页

    使用ADO.NET 数据访问技术制作web端组合查询加分页的功能关键在于查询SQL语句的拼接 以Car 表为例 每页显示3条数据 数据访问类使用查询方法,tsql 查询的连接字符串,查询的参数放到Ha ...

  2. webform组合查询和分页

    1.组合查询(1)数据访问类 //参数1:SQL语句 参数2:哈希表public List<Users> chas(string s,Hashtable has) { List<Us ...

  3. LINQ 小项目【组合查询、分页】

    使用 linq 在网页上对用户信息增删改,组合查询,分页显示 using System; using System.Collections.Generic; using System.Linq; us ...

  4. Linq组合查询与分页组合查询结合

    1.组合查询 <div>姓名:<asp:TextBox ID="T1" runat="server"></asp:TextBox& ...

  5. LinQ 组合查询与分页

    1.以开头查 public List<Car> Select1(string a){ return con.Car.Where(r => r.Name.StartsWith(a)). ...

  6. spring boot jpa 多条件组合查询带分页的案例

    spring data jpa 是一个封装了hebernate的dao框架,用于单表操作特别的方便,当然也支持多表,只不过要写sql.对于单表操作,jpake可以通过各种api进行搞定,下面是一个对一 ...

  7. LINQ 组合查询 和分页查询的使用

    前端代码 <%@ Page Language="C#" AutoEventWireup="true" Debug="true" Cod ...

  8. linq分页组合查询

    一.linq高级查 1.模糊查(字符串包含) 1 public List<User> Select(string name) 2 { 3 return con.User.Where(r = ...

  9. Webform(Linq高级查、分页、组合查询)

    一.linq高级查 1.模糊查(包含) 1 public List<User> Select(string name) 2 { 3 return con.User.Where(r => ...

随机推荐

  1. 安装 ibm-java-x86_64-sdk-6.0-9.3.x86_64.rpm 的三步骤

    yum install libstdc++-devel.x86_64 yum install compat-libstdc++-33.x86_64 rpm -ivh ibm-java-x86_64-s ...

  2. 【Project Euler 8】Largest product in a series

    题目要求是: The four adjacent digits in the 1000-digit number that have the greatest product are 9 × 9 × ...

  3. gem 更新源设置,ruby安装

    gem sources --remove http://rubygems.org/ gem sources -a http://ruby.taobao.org/ gem sources -l 结果只有 ...

  4. UVALive 4857 Halloween Costumes

    区间dp.对于最左边的点: 1.在该点穿的衣服只有该点用的到,即穿上就脱下.所以dp[ l ][ r ] = min(dp[ l + 1][ r ] + 1, dp[ l ][ r ]). 2.衣服仍 ...

  5. Linux日志分析的实战专题

      来自 日志也是用户应该注意的地方之一.不要低估日志文件对网络安全的重要作用,因为日志文件能够详细记录系统每天发生的各种各样的事件.用户可以通过日志文件 检查错误产生的原因,或者在受到攻击和黑客入侵 ...

  6. 〖Android〗/system/etc/fallback_fonts.xml

    <?xml version="1.0" encoding="utf-8"?> <!-- Fallback Fonts This file sp ...

  7. springmvc验证数据

    1.引入jar包 com.springsource.javax.validation-1.0.0.GA.jar  规范(只是定义) hibernate-validator-4.1.0.Final.ja ...

  8. webqq协议分析之~~~~验证是否需要验证码

    对于小黄鸡我想大家(喜欢在群里bb的人...)肯定一点都不陌生,那段时间大家在群里对小鸡是各种调戏啊,都有点不忍直视.那时我便想能不能自己也做个呢,后来想想还是算了吧,自己技术太渣渣,然后就不了了之. ...

  9. servlet响应解析

    response对象可以设置一些响应信息 1)设置状态码 response.setStatus(int) 2)设置响应头信息.定时刷新或者间隔 n 秒后跳转 response.setHeader(&q ...

  10. JQuery实现选择特定楼层回复

    JQuery实现选择特定楼层回复 需求: 一个论坛里面的小功能,除了回复帖子之外,也能够回复帖子以下的回复.详细实现细节: 每个回复有一个"回复"按钮,点击按钮实现: 在form表 ...