FilterExpression problem - multiple conditions
<p>I have an asp.net c# website I'm developing with Visual Web Developer Express Edition 2010. In this website I have a FilterExpression that should filter three criteria: a start date, end date, and keyword search. </p>

<p>I am able to get the start and end date filter working by itself, and also the keyword search is working by itself. What I'm having trouble with is getting all three to work together. </p>

<p>The code I'm using (below) displays all records by default (good) and does the following when trying to filter:</p>

<ul>
<li>search keyword: all records</li>
<li>search keyword plus date range: no records</li>
<li>just date range: all records</li>
</ul>

<p>Here's the code I have now, which tries to integrate all three but does not work. Any advice would be helpful:</p>

<pre><code>&lt;asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="&lt;%$ ConnectionStrings:sermonConnectionString %&gt;" 
SelectCommand="SELECT ID, sermon_date, sermon_speakerfirst + ' ' + sermon_speakerlast AS Speaker, sermon_title, sermon_subtitle, sermon_notes FROM what ORDER BY sermon_date DESC"
FilterExpression="([sermon_title] LIKE '%{0}%') AND ([sermon_date] &gt;= '{1}' AND [sermon_date] &lt;= '{2}')"&gt;
&lt;FilterParameters&gt;
    &lt;asp:ControlParameter ControlID="TextBox2" PropertyName="Text" Type="DateTime" ConvertEmptyStringToNull="true" /&gt;
    &lt;asp:ControlParameter ControlID="TextBox3" PropertyName="Text" Type="DateTime" ConvertEmptyStringToNull="true"/&gt;
    &lt;asp:ControlParameter ControlID="SermonSearch" PropertyName="Text" Type="String"/&gt;
&lt;/FilterParameters&gt;
&lt;/asp:SqlDataSource&gt;
</code></pre>
