高级搜索模式让我感到困惑? [英] advanced search pattern make me confused?

查看:81
本文介绍了高级搜索模式让我感到困惑?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

[

[Image]

i have fields in database i want user can search in all fields or any combination of fields
and but the opertors he or she want (AND,OR) but it make me confused in generating code
or query

notice :user can search in from one fields up to all fields
but he must enter operator before any fields he want to search

this my standard query

String SqlStatment = "SELECT * FROM [View_AnIssues]



当用户从第一个下拉列表中选择时,说(And)和第二个(Or)

然后MyQuery成为了



when user choose from thfirst dropdownlist say (And) and the second (Or)

then MyQuery became

String SqlStatment = "SELECT * FROM [View_AnIssues] where numField=value AND YearField =Value2 Or NeedsField=Value2;



我希望能够描述这种情况

请帮助我.



i hope to be able to describe the case

pleaze i need help

推荐答案

您的问题是您感到困惑".由于此问题与技术无关或与代码无关,因此我无法为您提供帮助.是的,对于代码,我可以建议您在任何使代码可读的地方使用括号将操作数和运算符括起来.还请记住,OR运算符优先于AND


为了.例如.
Your problem is that you are ''confused''. Since this problem is not technical or related to code, I can''t help you on this. And yes, regarding the code, I can suggest you to use parenthesis to enclose the operands and operators wherever you feel to make the code readable. Also remember that the OR operator takes precedence over AND


For. eg.
String SqlStatment = "SELECT * FROM [View_AnIssues] where (numField=value AND YearField =Value2 )Or NeedsField=Value2;


这篇关于高级搜索模式让我感到困惑?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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