Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 General SQL Server Forums
 New to SQL Server Programming
 Contains Operator using '@' (value from textbox)

Author  Topic 

Trini_NAtwaroo
Starting Member

1 Post

Posted - 2009-06-10 : 10:50:16
hey guys,

I am trying to search through a pdf with the searchable keyword coming from a textbox. I am tryin the test sql as follows select * from article where CONTAINS(file_name,'"*ash*"') and it works however this is just test, i tried select * from article where CONTAINS(file_name,'"*' + @key + '*"') but i am getting error near '+'. I am doing this in .net in a sqldatasource to display in a gridview. Can anyone please lend some assistance.

Thanks

raky
Aged Yak Warrior

767 Posts

Posted - 2009-06-10 : 12:41:43
quote:
Originally posted by Trini_NAtwaroo

hey guys,

I am trying to search through a pdf with the searchable keyword coming from a textbox. I am tryin the test sql as follows select * from article where CONTAINS(file_name,'"*ash*"') and it works however this is just test, i tried select * from article where CONTAINS(file_name,'"*' + @key + '*"') but i am getting error near '+'. I am doing this in .net in a sqldatasource to display in a gridview. Can anyone please lend some assistance.

Thanks



try this

select * from article where filename like '%'+@key+'%'
Go to Top of Page
   

- Advertisement -