N2012
asked on
Classic ASP - problem with MS SQL Select Query?
I'm using MS SQL select query in classic ASP which I cannot figure out.
If I query a field by this value
"LTC DWG # 05-08-1883, BGA50"
I get error 500, but if I remove the space in front of the #,
"LTC DWG# 05-08-1883, BGA50"
(in the SQL data as well as the query), it works fine.
At first, I thought it was a coding issue involving this string " #", but I can query the following value just fine without any error:
"LTC DWG # 05-08-1999, BGA48"
I've likely overlooked something very simple. Please help - any pointers appreciated a ton!!!
If I query a field by this value
"LTC DWG # 05-08-1883, BGA50"
I get error 500, but if I remove the space in front of the #,
"LTC DWG# 05-08-1883, BGA50"
(in the SQL data as well as the query), it works fine.
At first, I thought it was a coding issue involving this string " #", but I can query the following value just fine without any error:
"LTC DWG # 05-08-1999, BGA48"
I've likely overlooked something very simple. Please help - any pointers appreciated a ton!!!
ASKER
I build the SQL query like this:
SQLQRY = "SELECT TableName.* FROM TableName WHERE (SearchField LIKE '%" & VALUE & "%')"
SQLQRY = "SELECT TableName.* FROM TableName WHERE (SearchField LIKE '%" & VALUE & "%')"
SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
url encode?
Not on the server. That is only for transmissions between computers over HTTP.
Could you please post your complete query ?
ASKER
Problem was a combination of script and encoding. URL Encoding resolved part of the problem, but I also had an issue with the script, after all. Thanks for prompt responses!!!
So do you need more help or you are done?
ASKER
done, thanks!
additional space shouldn't causing you an SQL error, for most it will return record not was found for you.