Tidied SQL generation to use parameterised queries.  Added extension method for Result.