Follow us

Wednesday, December 7, 2011

LINQ to SQL #3 : Querying database using LINQ to SQL

First of all, we need to add a .dbml file as explained in previous post.

Technoscatter.dbml

Query #1: Get all members and their details.

Get all members and their details.

Query #2: Get First Name, Gender and Email Address of all members.

Get First Name, Gender and Email Address of all members.

Query #3a: SORTING : Get Member's Details on basis of First Name in Ascending Order.

Get Member's Details on basis of First Name in Ascending Order

Query #3b: SORTING : Get Member's Details on basis of First Name in Descending Order.

Get Member's Details on basis of First Name in Descending Order

Query #4: TOP : Get TOP 5 records of Members.

Get TOP 5 records of Members

Query #5: SKIP : Skip TOP 1300 records and get remaining records.

Skip TOP 1300 records and get remaining records

Query #6: DISTINCT : Get Distinct Member Names.

DISTINCT : Get Distinct Member Names

Query #7a: FILTERING : Get Members whose Name starts with 'A'.

FILTERING : Get Members whose Name starts with 'A'

Query #7b: FILTERING : Get Members whose Name ends with 'Y'.

FILTERING : Get Members whose Name ends with 'Y'

Query #7c: FILTERING : Get Members whose Name contains 'an'.

FILTERING : Get Members whose Name contains 'an'

Query #8: Get members who are 'Accountant'.

Get members who are 'Accountant'.

Query #9: Get members whose First Name is 'Aaron'.

Get members whose First Name is 'Aaron'.

Query #10: Get members whose DOB is on or after 31st December 2010.

Get members whose DOB is on or after 31st December 2010.


Digg Google Bookmarks reddit Mixx StumbleUpon Technorati Yahoo! Buzz DesignFloat Delicious BlinkList Furl

0 comments: on "LINQ to SQL #3 : Querying database using LINQ to SQL"

Post a Comment