从列表中搜索数据 [英] search data from list
问题描述
如果我在storeprocedure中写查询
选择名称,来自user_data的emailid
where(name LIKE @name +''%' ')或
(emailid LIKE @emailid)
然后搜索将用于名称文本框。但如果我写查询
选择名称,来自user_data的emailid
where(名称LIKE @name +''%'')或
(emailid LIKE @emailid +''%' ')
然后搜索不适用于任何文本框。
此代码有什么问题,我无法理解。请帮助我。
试试这个
选择名称,emailid 来自 user_data
其中
(名称 LIKE ' %' + @ name + ' %' 或 @ name null )
AND
(emailid LIKE ' %' + @ emailid + ' %' 或 @ emailid null );
希望有帮助你
if I write query in storeprocedure
select name,emailid from user_data
where (name LIKE @name + ''%'') OR
(emailid LIKE @emailid )
then search will work for name textbox .But if i write query
select name,emailid from user_data
where (name LIKE @name + ''%'') OR
(emailid LIKE @emailid + ''%'' )
then search will not work for any textbox.
what is problem with this code, i can''t understand.please help me.
Try this
select name,emailid from user_data where (name LIKE '%' + @name + '%' OR @name is null ) AND (emailid LIKE '%' + @emailid + '%' OR @emailid is null );
Hope it helps you.
这篇关于从列表中搜索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!