okay so pretty much I am using the asp.net 2.0 membership/roles.
i wanna make a search box that users can type in a name and it will search the database. most likely in the table "aspnet_Users"
so when users search i want it to be like this:
cmd = select * from [table] WHERE username = textbox1.text (ofcourse with parameters instead of concatenation).
but i want it to have a "like" in there
so if the users type in "fenix" they should get results matching CLOSE to fenix. so
masfenix, fenix, fenxi, and you know related names. that are similar.
should I use LIKE? and if so HOW do i use that?
is it just gonna be
cmd = select * from [table] where Username LIKE @.username
@.username = textbox1.text
?
thanks
Hello my friend,
The LIKE clause uses the % wild character. Here are some examples: -
-- get countries beginning with c
select * from tblcountry where countryname like 'c%'
-- get countries ending with land
select * from tblcountry where countryname like '%land'
-- get countries containing the word 'land' or 'stan'
select * from tblcountry where countryname like '%land%' or countryname like '%stan%'
Kind regards
Scotty
|||
hi thanks for the answer
i knew about that before just thoguht there would be more solutions
|||Hi,
Maybe the following link is helpful to you.
http://forums.asp.net/thread/1677621.aspx
Thanks.
No comments:
Post a Comment