Software Engineering Asked by Amessihel on December 12, 2021
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?
SQL recordset as a HTML Table - a bad practice?
No. But I think you're really asking if editing is ok. I say it is ok.
I've done this with ASP (i.e. like "Star Wars" when there was only the one movie). The point was to have user-enterable and editable data. Here is what worked for me.
Why this worked:
I realize this literally execute directly an SQL request inside a dynamic Web page. Is this a bad practice?
YES.
What I should have also done:
Answered by radarbob on December 12, 2021
Get help from others!
Recent Questions
Recent Answers
© 2024 TransWikia.com. All rights reserved. Sites we Love: PCI Database, UKBizDB, Menu Kuliner, Sharing RPP