|
|
|||||||||
|
|||||||||
|
|||||||||
| |
||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Rate Thread | Display Modes |
|
#1
|
|||
|
|||
|
SQL searching problem
Please help?
I'm having a problem with a SQL search query when using LIKE. When I call the query through an ASP page, No results are found. If I copy and paste that exact same SQL statement into EM, or Query Analyzer I get the record I need. The SQL statement is pasted below, ANY help would be greatly appreciated. Thank You BGrphc SELECT * FROM ARCHIVED_LISTINGS WHERE ( Status='A' OR Status='PC' OR Status='PS' OR Status='X' OR Status='T' OR Status='CS' OR Status='W' OR Status='NA' ) AND (MLS# LIKE '%searchString%' OR OwnerName LIKE '%searchString%' OR C_S_Address LIKE '%searchString%' OR Property LIKE '%searchString%' OR CONVERT(varchar, Price) Like '%searchString%' OR Associate LIKE '%searchString%' OR Condo_Sub LIKE '%searchString%' OR Other_MLS# LIKE '%searchString%' ) ORDER BY [OwnerName]; |
|
#2
|
||||
|
||||
|
if it works in query analyzer then the problem should lie in how ASP sends it or how it fills '%searchString%
|
|
#3
|
|||
|
|||
|
Thanks Kris,
This seems to happening with only a handfull of records. So since it works part of the time, I would think that ASP is sending correctly (I could be wrong though.) |
|
#4
|
|||
|
|||
|
try a response.write straight after you code that builds the SQL. It will print the results on screen then for you to see what happens. For instance if your sql statement is declared as sqldec
response.write sqldec response.end |
|
#5
|
|||
|
|||
|
Thank you everyone for your replies, problem Solved.
Stupid error on my part that has had me going since yesterday morning. The error was that there are 2 sql statements on that page for 2 separate DBs, the statement I posted earlier was tucked neatly inside of an IF Not SQL1.EOF THEN so I was only getting results from SQL2 if SQL1 was not empty. Thanks again everyone. BGrphc |
![]() |
| Viewing: ASP Free Forums > Database > Microsoft SQL Server > SQL searching problem |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|