Morning all
I'm using the following data source to retrieve some data from a database:
I would like to replace the two dates with today's date dynamically, e.g. date() - or at least that's what I tried using - both directly in the SQL statement and as parameters with default values. Neither ways worked though.
Any advice is much appreciated!
Dan
I'm using the following data source to retrieve some data from a database:
Code:
<asp:SqlDataSource ID="ds_downloads" runat="server" ConnectionString="<%$ ConnectionStrings:StPaulsDatabase %>"
ProviderName="<%$ ConnectionStrings:StPaulsDatabase.ProviderName %>" SelectCommand="SELECT downloadID, downloadTitle, downloadFilename, downloadFileSize, downloadFileType, downloadAddedOn, downloadShowFrom, downloadShowUntil, downloadCategory, downloadStatus FROM Downloads WHERE (downloadShowFrom <= CONVERT (DATETIME, '15/08/2006', 102)) AND (downloadShowUntil >= CONVERT (DATETIME, '15/08/2006', 102) OR downloadShowUntil IS NULL) AND (downloadCategory = @category) AND (downloadStatus = 1)">
<SelectParameters>
<asp:QueryStringParameter Name="category" QueryStringField="category" />
</SelectParameters>
</asp:SqlDataSource>
I would like to replace the two dates with today's date dynamically, e.g. date() - or at least that's what I tried using - both directly in the SQL statement and as parameters with default values. Neither ways worked though.
Any advice is much appreciated!
Dan