Here's what I do to get the SQL things working.

1) I get the query working in Sql Management studio.
2) I then form the same query in C#.

I use breakpoints and step through my code in the...