| View previous topic :: View next topic |
| Author |
Message |
jessie
Joined: 22 Apr 2010 Posts: 23
|
Posted: Wed Jun 30, 2010 11:12 am Post subject: How to select requried Records using Linq query |
|
|
Hi ..,
I am new to Linq., I my task i am ADO.net entity.
To retrieve required records from the entity., How can i write Linq query. Can any body please give me some examples.
Thanks and Regards _________________ Jessica., |
|
| Back to top |
|
 |
pavani
Joined: 26 Mar 2010 Posts: 37
|
Posted: Wed Jun 30, 2010 11:23 am Post subject: |
|
|
hello jessica,
Here I am giving few examples on Linq.
Suppose you had an ADO.NET Entity like MyDbEnties.
First you need to create an object for that entity
MyDbEnties db=new MyDbEnties();
var records = from c in db.tablename
select c; //To select all records from the data base
var records = from c in forum.tablename where c.Status == false select c; // using single where condition.
var records=from c in forum.tablename where c.Tags.TagID == id where c.Status == false select c; //using multiple where conditins
var records = from c in forum.tablename where c.Tags.TagID == id where c.Status == false orderby c.QuestionID descending select c; // using filters like order by
I hope you understand .., Better to practice more. _________________ Pavani.... |
|
| Back to top |
|
 |
|