Home /

| RSS

Free LINQ To SQL Training In Sydney

I am running a LINQ To SQL Training day on Saturday November 8th at Microsoft Office in North Ryde. The course is FREE for anyone to attend but there are only 20 places available. So if have not yet jumped into the wonderful world of writing LINQ queries. If you are considering LINQ To SQL [...]

[ More ] October 29th, 2008 | No Comments | Posted in News |

View T-SQL Query Generated By LINQ To SQL Using Linqpad

In my previous post I showed you three different ways to capture the T-SQL query generated by LINQ To SQL. A comment on the post reminded me that I forgot to mention a fourth way i.e. using Linqpad. In Linqpad when you have executed the query you can click on the SQL tab next to [...]

[ More ] September 23rd, 2008 | 4 Comments | Posted in Programming |

View T-SQL Query Generated By LINQ To SQL

While working with LINQ To SQL there are times when you are interested in looking at the query which will be executed on the database.  This post will cover different ways you can capture the query generated by LINQ To SQL.
SQL Server Profiler
SQL Profile has long been a preferred tool to capture activity on a [...]

[ More ] September 22nd, 2008 | 5 Comments | Posted in Programming |

Use SqlConnection With LINQ To SQL

LINQ To SQL allows us to use a SqlConnection object to connect to a database. The way to use a SqlConnection is to pass it as a parameter to DataContext object. DataContext object has constructor which takes in a IDbConnection and SqlConnection implements this Interface. Here I create a SqlConnection object and use it to [...]

[ More ] September 16th, 2008 | 4 Comments | Posted in Programming |

LINQ To SQL Join On Multiple Conditions

LINQ To SQL or just plain LINQ allows us to do a join on multiple conditions using an elegant technique. In this post I will show you how to perform a Join on multiple conditions. As an example I will take two tables called House and ShoppingMall.

Both these tables have PostCode and CouncilCode as common [...]

[ More ] September 16th, 2008 | 12 Comments | Posted in Programming |

Channel 9 Visits One .Net Way

Channel 9 does a “This Week On Channel 9” video every week and this week they paid a visit to One .Net Way. They mentioned my post about Retrieving a list of applications using LINQ in their news video. I am very happy to see One .Net Way mentioned on Channel 9. It feels good [...]

[ More ] September 9th, 2008 | No Comments | Posted in News |

Get A List Of Installed Applications Using LINQ And C#

To get a list of installed applications we need to look into registry. Microsoft.Win32 namespace contains objects which can be used to work with Windows Registry. In this post I will show you some code where I use the power of LINQ to retrieve and display a list of all applications installed on a machine.
The [...]

[ More ] August 29th, 2008 | 14 Comments | Posted in Programming |

LINQ Equivalent Of Where IN

Working with LINQ to SQL I came across a need of writing a LINQ query equivalent of  T-SQL “Where IN” clause. This is what T-SQL query looks like.

SELECT CustomerID, CompanyName, ContactName, ContactTitle, Address,
City, Region, PostalCode, Country, Phone, Fax
FROM [...]

[ More ] August 25th, 2008 | 8 Comments | Posted in Programming |

Find Duplicates Using LINQ

How can we find duplicate occurrences of values in a collection? I will demonstrate this here using a collection of cities. City class looks like this:

public class City
{
public string Name { get; set; }
public string Country { get; set; }
}

Cities collection is initialised with this code:

List<City> cities [...]

[ More ] August 16th, 2008 | 1 Comment | Posted in Programming |

Different Flavors Of LINQ

You may have noticed from my blog posts lately that these days I am spending considerable time working with LINQ. Although I mainly concentrate on LINQ To Objects and LINQ To XML, I often wander around and play with other flavors of LINQ as well. Today, just out of curiosity I wanted to see how [...]

[ More ] August 14th, 2008 | 2 Comments | Posted in Programming |

Tutorial Reading A Text File Using LINQ

Introduction
At times us developers have to deal with delimited text files in our applications. Such files have been around since yonks and I often come across data import/export tasks where delimited files are used. Till now the common way in .NET has been to read each line and then extract data using some sort of [...]

[ More ] August 13th, 2008 | 11 Comments | Posted in Programming |

Dynamic Sort With LINQ

In this post I will show you how to perform dynamic sorting with LINQ. I will work with a simple collection of City class. City class is defined below.

public class City
{
public string Name { get; set; }
public string Country { get; set; }
}

The collection is initialised using [...]

[ More ] August 4th, 2008 | 5 Comments | Posted in Programming |