ReportViewer control: Look out for appropriate version when using in Server mode (Remote Processing)

The report viewer control (available for Windows Forms as well as ASP.NET applications) is used to display reports in our applications. However, it was an interesting observation for me that the ReportViewer control can connect to specific SQL server versions when used in Server Mode(or Remote Mode). Read the rest of this entry »

TSQL: Some interesting usages of Coalesce

The coalesce function is a really powerful function that can help us in various scenarios. It is described in this MSDN document so I am not going to discuss its working in this post. Instead, I will only present a few interesting usages.

  • Calculating overrideable attributes
  • Combining results from Full Outer Join
  • String concatenation

Read the rest of this entry »

Entity Framework: Queries involving many to many relationship tables

Entity framework handles tables participating in Many to Many relationship in a nice manner. If the junction table (sometimes called bridge table, association table, link table, etc) only consists of the foreign keys and no other columns, then that table is abstracted by EF and the two sides get a navigational property exposing a collection of the other side. If the junction table contains other fields as well (e.g. the table has its own primary key column), then that junction table is included in the model with many-to-one relationships with both the participating tables. This post will present some common LINQ queries involving the many to many relationship tables in both scenarios: when the junction table is abstracted by EF, and when it is exposed. Read the rest of this entry »

Cannot access all microsoft.com domain websites

I got an strange problem today. I was not able to access any *.microsoft.com websites. Finally, after an hour of searching, I was able to find an interesting solution to this frustrating problem. I just restarted the DNS Client service and all things went back to normal. Awesome!!! I am back to work.

LINQ: Where are my extension methods?

The powerful Extension Methods due to LINQ have made our development really simple and easy. However in some cases these methods are not available as depicted in the following screenshot.

Here are a few scenarios in which we may find our extension methods missing:

  • Iterating through all the controls in a Windows Form (or any other container control) via their Controls collection
  • Iterating through items in our classic non-generic collections (e.g. ArrayList) under System.Collections namespace
  • Iterating through Columns in a DataGridView control
  • Iterating through Matches while working with Regular expressions
  • Retrieving enumeration values via Enum.GetValues

Read the rest of this entry »

TSQL: Error handling with Try Catch from a .NET perspective

Starting with SQL 2005, we can handle unexpected situations in our TSQL scripts/procedures/functions in an structured manner using the famous Try/Catch methodology, similar to what we are used to in our object oriented programming languages (C#, Java, etc). This post will describe certain similarities and how to enjoy the features that look absent at the first look. The MSDN document that describes error handling in TSQL in much detail is: Using TRY…CATCH in Transact-SQL
Read the rest of this entry »

Windows 7: Quick excel like filtering in Windows Explorer

I have been using Windows 7 since its beta version. I also used Windows Vista for some time, but could not figure a really powerful feature in Windows Explorer available in Details View mode. A few days back, when I tried to sort my file listing by size, my mouse pointer slightly slipped and I clicked on the corner. This brought an excel like filtering menu as shown below:

Wow!! After the great search box (at the top right corner in Windows Explorer), this is yet another great way to quickly locate our desired files. Here are some more screen shots.

I am not sure how many of you already knew this. This was a very interesting feature I wasn’t aware of, so I wrote a quick post to share this.