KB Issue
This is a common error that provides little to work with when troubleshooting.
Issue Details
This error was caused when the information was not sent to the Database Query properly.
Recreate Issue
This is your QueryString
?page=some_(Name)
Copy
Search Site
Search Google


This is your Variable
getPage = Request.Querystring("page")
Copy
Search Site
Search Google


This is the database value
some_(Name)
Copy
Search Site
Search Google
The variable of getPage is not the same as the data value from the database
Thus creating the error that we have here.
Resolve Issue
Let's say that you have the following QueryString


?page=some_(Name)
Copy
Search Site
Search Google


In your Database Query, you have this

Code Example
sqlCt.Parameters.Append sqlCt.CreateParameter("@PicsFolder", 200, 1, 50, getPage)


And your getPage is

getPage = Request.Querystring("page")
Copy
Search Site
Search Google


Now, in your database, the value for the page will be

some_(Name)
Copy
Search Site
Search Google


Now
To ensure we can query this information properly, we need to create a function that converts the QueryString back to its original format.

This is our custom Function used to protect our site(s) from SQL and XSS Injection, and it can also convert the QueryString back to its original database format.
>
Copy
Search Site
Search Google

[ASP Classic - ProtectSQL]
CFFCS | CarrzSynEdit: | ASP/VBScript
Function ProtectSQL(SQLString)
SQLString = Replace(SQLString, "">'", "'") ' replace single Quotes with Double Quotes

SQLString = Replace(SQLString, ">", "&gt;") ' replace < with &gt;

SQLString = Replace(SQLString, "<", "&lt;") ' replace > with &lt;

SQLString = Replace(SQLString, "(","&#40;") ' replace ( with &#40;

SQLString = Replace(SQLString, ")","&#41;") ' replace ) with &#41;

SQLString = Replace(SQLString, "&", "&amp;")
SQLString = Replace(SQLString, "", "")
SQLString = Replace(SQLString, "®", "&#xAE;")
SQLString = Replace(SQLString, "©", "&copy;")
SQLString = Replace(SQLString, "%", "&#37;")
SQLString = Replace(SQLString, vblf,"<br />") ' replace vblf with <br /> (This is mainly used for Memo fields.

SQLString = Trim(SQLString)
ProtectSQL = SQLString
End Function

Now, we will wrap our Variable getPage in this function.


getPage = ProtectSQL(Request.Querystring("page"))
Copy
Search Site
Search Google


When the Query is run against our database, it will convert the String back to its original format and present your data.