SqlExpression Join not returning results

Hi,

I am using SqlExpression to join multiple tables. If I use CaptureSqlFilter, the correct SQL is being generated (and if I run in SSMS the right number of rows are coming back).

Query build:

  var q = conn.From<QuestionResponse>()
                .Join<QuestionResponse, SurveyResponse>()
                .Join<SurveyResponse,FileUpload>()
                .And(
                    d =>
                        
                        d.QuestionId == request.QuestionId);

                q.Skip(request.Skip)
                .Take(request.Take);
            using (var captured = new CaptureSqlFilter())
            {
                var results = conn.Select<FreeTextResponse>(q);
                captured.SqlStatements[0].PrintDump();
                return new QueryResponse<FreeTextResponse>
                {
                    Offset = q.Offset.GetValueOrDefault(0),
                    Total =results.Count,
                     Results = conn.Select<FreeTextResponse>(q)
                };
                
            }

SQL Being generated is right (and returning right records in SSMS):

 SELECT TOP 50 "FileUpload"."FileName", "SurveyResponse"."ResponseDate", "QuestionResponse"."Response" 
FROM "QuestionResponse" INNER JOIN "SurveyResponse" ON
("SurveyResponse"."SurveyResponseId" = "QuestionResponse"."SurveyResponseId") INNER JOIN "FileUpload" ON
("FileUpload"."FileUploadId" = "SurveyResponse"."FileUploadId")
WHERE ("QuestionResponse"."QuestionId" = 9)

But the results in the code are always empty. I have upgraded to 4.0.60 but still happening.

G

CaptureSqlFilter just does that, it only captures the SQL and parameters without executing it. You should only be using it during development when you want to inspect the generated SQL and Params, but you need to remove/comment it out in order to execute it.

Thanks! Stooopid me.