Seems like the error is related to "Roles", but I already logged-in as administrator user, It's the same user when I logged-on my designer, so I don't know if there are still limitations as an administrator.
FWIW Legacy DB Access can be a security hole. Your queries in your script don't look too complicated and it's good to use the prep version, but you can convert them to named queries and then turn off this permission to minimize risk. Not to mention named queries provide one source for all your CRUD (Create, Read, Update, Delete) operations which helps you not have to re-write the same queries in multiple places throughout your application.
Don't turn on Legacy Database permissions for new projects. It is called "Legacy" because it exists to accommodate upgrades from Ignition versions before Named Queries existed.
Learn to use Named Queries. If you have an odd circumstance that an NQ cannot handle, put the "Prep" query in a project library script, call it from a gateway message handler, and use system.util.sendRequest() to call it from client scope. If you do this latter, and any dynamic SQL is constructed, be particular about excluding client-supplied strings, or the security hole opens back up.
You got it. There is https://inductiveuniversity.com/ if you haven't checked it out yet to learn all about it. I would also say pay this forum a visit when you get stuck or just randomly throughout the week during downtime (if you have any) and you can learn a lot regarding best practices and techniques from the very knowledgeable users here.