ASP Classic SQL Server LIKE Query not working properly
Hello All;
The record exist in the database, in both columns, so, it SHOULD state that the record exist.
However, it is not, it is stating that the record does not exist.
Even though it is there.
We are looking at BOTH columns, as the record will exist, ONLY if both columns have the correct information.
The PageList Column, this will have different entries in it like so.
So, that is why I am using the LIKE, so that I can check and see if the "Movies_(Romance)" exist in the column. If not, then add it, else, NOT.
Can someone please shine some light on this?
As I am at my wits end, I do not know what in the world is going wrong.
I got the same code to work in another part of the page, however, I cannot get this one to function.
One last thing.
I ran the same Query inside of SSMS, and it ran perfectly, and like expected, it is just NOT working in the script below.
Carrzkiss
Code:
getTitle = "Movies_(Romance)"SongName = "Let Me Know"<%' Both getTheSong and getTitle are coming from form fields.'getTheSong = replace(SongName," ","_")strTerm = "%" & getTitle & "%"Set sqlUsage = Server.CreateObject("ADODB.Command")sqlUsage.ActiveConnection=ConnsqlUsage.Prepared = truesqlUsage.commandtext="SELECT SongTitle, PageList FROM Songs WHERE SongTitle=? and PageList like ?"sqlUsage.Parameters.Append sqlUsage.CreateParameter("@SongTitle", adVarChar, adParamInput, 250, getTheSong)sqlUsage.Parameters.Append sqlUsage.CreateParameter("@PageList", adVarChar, adParamInput, 250, strTerm) set rschSong = sqlUsage.executeif rschSong.eof thenresponse.write "Does not exist"elseresponse.write "Already exist!"end if%>