Hi ,
This is murali krishna i want one example on LINQ.
How can i create LINQ query and how to execute it. Please give me answer
LINQ
2 Answers
Know the answer? Post it. Somebody with the same question will find it here.
Know the answer? Post it. Somebody with the same question will find it here.
Answer a question in the forums and earn +20 SHARP for every answer.
See unanswered questions
DevSocialUpcoming · 3rd editionAI Agents ConferenceDec 1–3, 2026Live onlineFree to attend5days leftRegister
Vishal GilbileRank #268 · 9.4K reputationPosted Apr 1, 2013, 2:18 AM EDT
Well krishna linq can be used to query any database by using a standard query format. Let's assume we want to query an array, try to read all the values of an array and store it in listbox. Following is the code for the same. For firing any linq query you need to set up 3 things
1. Identiy your datasource
int[] arr={1,2,3,4,5,6,7,8,9,10}
2. Create your query
var query=from o in arr select o;
3. Execute your query.
foreach(var result in query)
{
listbox1.Items.Add(result.ToString());
}
Hope that solves your problem.
With Regards,
Vishal Gilbile
Murali Krishna30 reputationPosted Apr 1, 2013, 2:28 AM EDT