Click here to Skip to main content
15,919,245 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hello Dear Friends I have created a stored procedure that is working well when i use = operator instead of like keyword. If i use like keyword in Sql server it isworking but in asp.net +C# pages it is not working but if i use = operator in my procedure it will works good with Asp.net page i am not getting problem.

SQL
Select J.JobID From dbo.Jobs J Where J.Keywords Like @Keyword + '%' AND
     J.MinExp >= @Exp AND J.Location = @Location AND J.FunctionalArea = @FunctionalArea
     AND J.Industry = @Industry AND J.PostedDate BETWEEN (GETDATE() - @Freshness) AND (GETDATE())
     ORDER BY J.PostedDate DESC

Please tell me if there is any problem everything is working well when i use = operator instead of Like keyword but i need Like keyword please help me.
Posted

Add
Print @Keyword

to your stored procedure and see what you pass as @Keyword to SQL. You may just have quote issue in your statement.
 
Share this answer
 
This code is ok there is no problem in this code, but problem in passed parameters.
 
Share this answer
 
Comments
Satyendra Kumar(Analyst Programmer) 9-Jun-11 12:49pm    
problem is in this code just little that i had mention space between Like @Keyword + '%' it should be in this format @Keyword+'%'. Now it is working. I don't know what was there but after doing this I solved this.
problem is in this code just little that i had mention space between Like @Keyword + '%' it should be in this format @Keyword+'%'. Now it is working. I don't know what was there but after doing this I solved this.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900