The easiest way is to only escape the SQL when you really paste into the database:
course = trim(request("course"))
Make the SafeSQL function:
function SafeSQL(TempStr)
SafeSQL = Replace(TempStr,"'","''")
end function
Then when you insert:
"INSERT INTO table(course) VALUES ('" & SafeSQL(course) & "')"
Disclaimer: I only have ASP knowledge, I really don't know the best practices.
source
share