title: Create custom Queryable in LINQ to SQL
body: <p>I want to build an advanced search with Linq to SQL.<br>
  I already accomplished my purpose with <code>Dynamic query with Linq</code> using this <a href="http://pranayamr.blogspot.com/2011/04/dynamic-query-with-linq.html" rel="nofollow noreferrer">article</a>, but <code>DynamicLibrary</code> has a specific problem with some datatype like dates. So it <strong><em>can not</em></strong> translate date values to LINQ and throw an error.<br>
  I already ask this problem <a href="https://stackoverflow.com/questions/51597447/issue-with-compare-dates-in-where-clause-in-dbml-linq?noredirect=1#comment90162716_51597657">here</a> and didn't get answered. <br>
  So I started changing my method to use Queryable.<br>
  This is what I want to do with Queryable:<br></p>
  
  <pre><code>private void button1_Click(object sender, EventArgs e)
      {
          LinqTestDataContext ctx = new LinqTestDataContext("Data Source=.;Initial Catalog=valveManagement2018;Integrated Security=True");
          if (rbvalveStreet.Checked)
          {
              if (!string.IsNullOrEmpty(valveStreet.Text))
              {
                  var qry1 = Queryable.Select(Queryable.Where(
                           ctx.valves, p =&gt; p.valveStreet.Contains(valveStreet.Text)), p =&gt; new { p.valveId, p.aTId,p.typeId, p.valveStreet });
              }
          }
          if (rbtypeId.Checked)
          {
                  var qry2 = Queryable.Select(Queryable.Where(
              ctx.valves, p =&gt; p.typeId == cbTypeId.selectedIndex), p =&gt; new { p.valveId, p.aTId, p.typeId,p.valveStreet });
          }
  
          var qryFinal = qry1.Concat(qry2);
  
          dgv.DataSource = qryFinal;
      }
  </code></pre>
  
  <p>But the problem is here, Concat act Like <code>OR</code> Operand and the result is
   <code>qry1 OR qry2</code>, But I want to get something Like <code>AND</code> Operand somthing Like <code>qry1 AND qry2</code>.<br>
  So how can I handle this problem or any safe way exist to handle custom where in linq to sql?</p>