WEBFORM--LINQ Page Combination Query

Source: Internet
Author: User

First, the LINQ advanced Search

1. Fuzzy check (string contains)

View Code

2. Check the beginning (StartsWith, start with XX)

Public list<user> Select (string name)    {        return con. User.where (r = R.username.startswith (name)). ToList ();    }

3. Check the end

Public list<user> Select (string name) {        return con. User.where (r = R.username.endswith (name)). ToList ();    }

4. The array length (number) found

CList. Count ()

5. Max value: Max (r = r.price);

Public decimal? Selectmax ()    {        return Con.car.Max (r = r.price);    }

6. Minimum value: min (r = r.price);

Public decimal? Selectmin ()    {        return con.car.Min (r = r.price);    }

7. Average: Average (r = r.price);

Public decimal? Selectavg ()    {        return con.car.Average (r = r.price);    }

8. Sum: sum (r = r.price);

Public decimal? Selectsum () {return Con.car.Sum (r = r.price);}

9. Sort:

1. Order orders by ascending value.
2. OrderByDescending the values in descending order
3. ThenBy performs a secondary sort in ascending order.
4. ThenByDescending performs a secondary sort in descending order.
(1) Ascending: ORDER by (r = r.price)

   Public list<car> ()     {         return con.car.OrderBy (r = r.price). ToList ();     }

(2) Descending: orderbydescending (r = r.price)

  Public list<car> ()    {              return con.car.OrderByDescending (r = r.oil). ToList ();    }

Second, pagination and combination query

aspxAspx.cs

WEBFORM--LINQ Page Combination Query

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.