Connecting Tech Pros Worldwide Help | Site Map

% WildCard

OuTCasT's Avatar
Needs Regular Fix
 
Join Date: Jan 2008
Location: South Africa
Posts: 353
#1: Apr 23 '08
Hi guys.

id like a gridview to display the results from the textbox search, but i want it to search the db for anything i type in and match it.

sort of like

Expand|Select|Wrap|Line Numbers
  1. select * from [tablename] where [columnName] LIKE '%%'
but i want the value to be taken from the textbox.

Expand|Select|Wrap|Line Numbers
  1. select * from [tablename] where [columnName] LIK '% + search.text + %'
OuTCasT's Avatar
Needs Regular Fix
 
Join Date: Jan 2008
Location: South Africa
Posts: 353
#2: Apr 23 '08

re: % WildCard


hi guys nvm i got the solution

Expand|Select|Wrap|Line Numbers
  1. Select * from [tableName] where [ColumnName] LIKE ('%' + @search + '%')
Thanks anyways
ck9663's Avatar
Expert
 
Join Date: Jun 2007
Posts: 1,925
#3: Apr 23 '08

re: % WildCard


Build your query from your apps.

-- CK
Reply