title: Conditional statement in sql query on classic ASP Page
body: <p>I am fetching three values in my page named 123.asp
  <code>(123.asp?School=NewEnglishSchool&amp;Batch=1&amp;AcademicYear=2)</code></p>
  <pre><code>School = Request.QueryString(&quot;School&quot;)
  Batch = Request.QueryString(&quot;Batch&quot;)
  AcademicYear = Request.QueryString(&quot;AcademicYear&quot;)
  </code></pre>
  <p>I have a simple query in form like below
  strSqlData=&quot;select * from MyTable where gender=&quot;male&quot;&quot;</p>
  <p>I need to create a query like below, if I found a value for Batch and AcademicYear except for School on the page via <code>Request.QueryString means (123.asp?Batch=1&amp;AcademicYear=2)</code></p>
  <p>then I want to write a query something like this</p>
  <pre><code>strSqlData=&quot;select * from MyTable where gender=&quot;male&quot; 
  if len(AcademicYear)&lt;&gt;o then 
  and AcademicYear='&quot;&amp;AcademicYear&amp;&quot;'
  
  elseif len(Batch)&lt;&gt;o then 
  and Batch='&quot;&amp;Batch&amp;&quot;'
  end if  
  
  elseif len(School)&lt;&gt;o then 
  and School='&quot;&amp;School&amp;&quot;'
  end if  &quot;
  </code></pre>
  <p>I want to create something like above but in proper method without using case, because I have so many filters on the page like school, batch and Academicyear.</p>