I am using SqlDataSource control to list out search result when user choose the date, if the date is null, then it list out all record.
<asp:SqlDataSource ID="SqlDataSource1" runat="server" meta:resourcekey="SqlDataSource1" ConnectionString="<%$ ConnectionStrings:Test_ConnectionString %>"
SelectCommand="select MeetingID, MeetName as MeetingName, MeetDate, MeetTime from Meeting where Status ='Recorded' and Case when @sel_to_date ='' then MeetDate <= '2200-12-31' else MeetDate = @sel_to_date end order by MeetDate desc, Meettime desc ">
<SelectParameters>
<asp:ControlParameter ConvertEmptyStringToNull="true" ControlID="datepicker" Name="sel_to_date" DefaultValue="" PropertyName="Text" Type="String"/>
</SelectParameters>
</asp:SqlDataSource>
But it return syntax error.
I want all to list all records when user leave the textbox blank. How to do that?
regards, Joe