<i><b>Originally posted by : John Hankey (jhankey@blueyonder.co.uk)</b></i><br /><br />Using the following SP:<br /><br />SELECT *<br />FROM Inventory_Table<br />WHERE PartNumber Like "*"+@Search+"*";<br /><br />I get the correct result when running the SP from within Access , However passing @Search from my ASP page does not return any results.<br /><br />If I change the SP to a simple Select statement I get the results I expected, asssuming I pass the right string.<br /><br />Any Ideas?<br />
<i><b>Originally posted by : norm (norm@istar.ca)</b></i><br />Use single quotes, and % instead of *. The semicolon isn't necessary. Also, put the SQL string in a variable and then you can <br /><br />Response.Write strSQL<br />Response.End<br /><br />and then cut and paste the string right into Query Analyzer (if you're using SQL Server) to test them out. Access has its own bizarre syntax (and you can't do complex queries.)<br /><br /><br />SELECT *<br />FROM authors<br />WHERE au_lname Like '%'+'b'+'%'<br /><br /><br />------------<br />John Hankey at 4/1/2002 10:42:50 AM<br /><br /><br />Using the following SP:<br /><br />SELECT *<br />FROM Inventory_Table<br />WHERE PartNumber Like "*"+@Search+"*";<br /><br />I get the correct result when running the SP from within Access , However passing @Search from my ASP page does not return any results.<br /><br />If I change the SP to a simple Select statement I get the results I expected, asssuming I pass the right string.<br /><br />Any Ideas?<br />
Was this answer helpful ?
Yes No