How to judge multiple text boxes during Query

Source: Internet
Author: User

Some netizens in Insus. NET are asking questions. Let's look at his questions:



Netizens are thinking of a problem and are trying to solve this problem. Maybe the number of text boxes is still increasing in the future. if these judgments are not solved, these if statements will become more and more popular, more serious maintenance is becoming more and more complex.
Let's take a look at the following demo. Insus. NET executes three queries. When the first query is executed, the execution results of the three SQL statements are the same. For the second time, the condition of the second and third SQL statements is changed. When the second statement is executed again, the execution result of the second statement is the same as that of the third statement. The last time is the condition for changing the SQL statement of the third sentence, it will overwrite the corresponding result.



What is the problem? If a text box has a value passed in, it will be judged by the value. If the text box is not filled in, it seems to have skipped this condition.

 


You can refer to Insus. NET's blog on query and search:
Http://www.cnblogs.com/insus/archive/2011/03/30/1999759.html

Http://www.cnblogs.com/insus/archive/2011/03/30/1999795.html

Http://www.cnblogs.com/insus/archive/2013/04/06/3002054.html

Http://www.cnblogs.com/insus/archive/2010/06/17/1759672.html

Http://www.cnblogs.com/insus/articles/1360985.html


Therefore, you do not need to make any judgment on the front end. No matter whether there is a value or no value, you just need to pass in the SQL statement or stored procedure as a parameter.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.