Hi I'm trying to pass default value to a sql parameter which is
<asp:SqlDataSource ID="SqlDataSource1" runat="server"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT * FROM [Activ] WHERE ([DayNum] = @DayNum)">
<SelectParameters>
<asp:Parameter Name="DayNum" Type="Int32" />
</SelectParameters>
</asp:SqlDataSource>
and the Page_Load goes like this
Int32 MyDay;
MyDay = (Int32)DateTime.Today.DayOfWeek;
MyDay = MyDay + 1;
SqlDataSource1.SelectParameters["DayNum"].DefaultValue = MyDay;
Intellisense says that I canôt convert int into string underlining red MyDay, I get it but, if I use ToString
then the SQL statement won't work since DayNum is int.
How can I work this out? Thank you
View Complete Post