在多项选择中搜索用户 [英] search user on multiple selection
本文介绍了在多项选择中搜索用户的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我正在使用一个小型应用程序,并且我想在多种条件下过滤所有客户,例如订单,订单,提前付款.我正在使用where
条件.效果不是很好.我想输入DOB然后按DOB显示所有客户,如果我输入所有3选项,然后搜索所有条件,例如google Advanced Search.
I am working with a small application and I want to filter all the customer on multiple conditions such as dob, order, advance. I''m using where
condition. It is not working very well. I want if I enter DOB then display all the customer according to DOB if i enter all the 3 option then search all the condition like google Advanced Search.
推荐答案
hi
在这里我给你一个例子
hi
Here i am giving you one example
declare @name varchar(100)='b',
@dob date='2010-12-10'
if(@name is null and @dob is null)
BEGIN
select * from tblUsers
END
else if(@name is not null and @dob is null)
BEGIN
select * from tblUsers where tblUsers.strFirstName like @name+'%'
END
else if(@name is null and @dob is not null)
BEGIN
select * from tblUsers where tblUsers.dateDateOfBirth=@dob
END
else
BEGIN
select * from tblUsers where tblUsers.strFirstName like @name+'%' and tblUsers.dateDateOfBirth=@dob
END
我希望这个想法对您有帮助
I hope this idea may help you
该论坛讨论的是同一件事: http://forums.asp.net/t/1381718.aspx [ ^ ]
希望对您有所帮助!
This forum discusses the same thing: http://forums.asp.net/t/1381718.aspx[^]
I hope this helps!
共享查询可以使我们对解决方案一无所知,但我认为您对AND和OR的使用条件不太满意.
请参阅此 [
Sharing your query can give us little idea towards but I think you aren''t putting condition well with AND and OR.
See THIS[^] my answer will guide you towards if you are making any mistake with condition.
Please share your code too.
这篇关于在多项选择中搜索用户的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文