从grideview搜索数据 [英] search data from grideview

查看:83
本文介绍了从grideview搜索数据的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如果我在storeprocedure中写查询



 选择名称, emailid 来自 user_data 
其中(名称 LIKE @ name + ' %' OR
(emailid LIKE @ emailid



然后搜索将用于名称文本框。但是如果我写查询



< pre lang =SQL> 选择名称,emailid 来自 user_data
where (name LIKE @ name + ' %'
(emailid LIKE @ emailid + ' < span class =code-string>%')





然后搜索不适用于任何文本框。

这个代码有什么问题,我无法理解。请帮助我。

解决方案

试试这个



 选择名称,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.


这篇关于从grideview搜索数据的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆