Your SQL statement seems to be missing a comparison value. You can see:
where ProductID = ORDER BY priority
it should be something like:
where ProductID = 1 ORDER BY priority
So the comparison value isn't being set properly. If you attach the page you are working on I could comment on the code directly and where it might be wrong.