PetaPoco Page method returning You have an error in your SQL syntax error while Fetch or Query Methods run just fine
Hi Everyone,
I have encountered a very strange issue where when I try to load some data through the Page method of PetaPoco an error is thrown, saying the following: "You have an error in your SQL syntax". Here below is an example:
var properties = db.Page<PropertyListingItemPartialModel>(currentPageNumber, pageSize, sqlQuery);
While when I use the Fetch or Query methods, everything runs just fine without any errors. Here below is an example:
var propertiesTest1 = db.Fetch<PropertyListingItemPartialModel>(currentPageNumber, pageSize, sqlQuery);
var propertiesTest2 = db.Query<PropertyListingItemPartialModel>(sqlQuery);
I have checked my SQL query and cannot spot any mistakes and I believe if there was, it will not work either way and not just when using the Page method.
PetaPoco Page method returning You have an error in your SQL syntax error while Fetch or Query Methods run just fine
Hi Everyone,
I have encountered a very strange issue where when I try to load some data through the Page method of PetaPoco an error is thrown, saying the following: "You have an error in your SQL syntax". Here below is an example:
While when I use the Fetch or Query methods, everything runs just fine without any errors. Here below is an example:
I have checked my SQL query and cannot spot any mistakes and I believe if there was, it will not work either way and not just when using the Page method.
Does anybody have a clue why this is happening?
Thanks a lot for your support
Try adding ORDER BY to your sqlQuery
is working on a reply...