Tag: LINQ
-
How to view the generated SQL Query of LINQ
Have you ever thought of viewing generated SQL query of LINQ you write? You may need the generated query for the debugging and the logging purposes. In this post let us see how to print the generated SQL query on the console. Let us consider you have written LINQ as follows: You can print the…
-
What is difference between First and FirstOrDefault in LINQ?
Last week I were presenting LINQ to group of almost 100 audience. While writing query a question raised that what is difference between First and FirstOrDefault . At that time I was not very sure about answer so I asked audience to help me. One from audience answered this question. So credit of this blog…
-
LINQ to XML in a Nutshell
Data may exist in much form. You may have data in relational tables residing on a relational database or portable data in form of XML. Since data exist in many forms, obviously there are many ways to manipulate or access them. One of the most popular ways of sharing data is as XML. Considering prominent…
-
ASP.Net GridView with LinqDataSource
In this post I will walkthrough on using ASP.Net Gridview with LinqDatasource. You can bind a GridView with LinqDataSource and would able to Edit Delete View data without writing a single line of code. To see how it works , follow the steps below; Step1 Crate a ASP.Net Web Application. Step 2 Right click and…
-
Learning Video Executing Stored Procedure in LINQ to SQL
Source code used in Video ***********************************************************
-
Executing SQL Query using LINQ to SQL
In this post, I will discuss how we can execute a SQL Query directly from LINQ. Explanation To execute SQL query there is a method in DataContext class called ExecuteQuery ExecuteQuery takes two input parameter 1. SQL Query as string 2. Parameters used in SQL query And it returns an IEnumerable. Example Below code will…
-
Fetching different values in LINQ Concurrency conflict
If you have not read my post Resolving Concurrency conflicts in LINQ then I strongly recommend you to read that. This post is a simple added extension of said post. After reading resolving concurrency conflict in LINQ you are pretty much aware of resolving mechanism of concurrency conflicts. Now assume a requirement that you need…