I'm maintaining an intranet using ASP Classic. Some of pages looks like one or more HTML tables used for administration tasks.
Those tables are obtained by SQL requests. Server side, they are kind of "raw". They are next decorated client-side with icons and buttons to perform those tasks or getting information from AJAX calls.
Basically, the processing looks like this:
<html> <head> <script> function decorateTables(); let fileTables = document.getElementById("files"); // and so on... } </script> </head> <body onload="decorateTables()"> <div class="panel-box"> <% Dim sqlRequest sqlRequest = "SELECT name, datecreated FROM files WHERE name LIKE 'adm-%'" // Outputs a table whose id is "files" outputTableFromSQL("files","extra","parameters", sqlRequest) %> </div> </body> </html>
I realize this literally execute directly an SQL request inside a dynamic Web page. Is this a bad practice? Are there some guidelines that could help?
I could have perform the HTML table generating with a DB record set rather than an SQL request (which would need to rewrite
outputTableFromSQL() as a
outputTableFromRS()), but isn't it like moving the issue further away?