MyDataSource.SelectParameters["startDate"].DefaultValue =
fromDate.SelectedDate.Date.ToString();
As you can see, I am setting the default value for the parameter in my .Net SqlDataSource. I do not think the string displays the correct format. What is the correct format, so Datetime T-SQL will fit it correctly?
Here are the formats that are being displayed right now:
- 5/1/2009 12:00:00 AM
- 5/4/2009 11:59:59 PM
Edit: Before I got the DataSource, where it should have been written by SqlDataSource
And here is the code
<asp:SqlDataSource ID="MyDataSource" runat="server" ConnectionString="<%$ ConnectionStrings:sampledb %>" SelectCommand="Recording_Select" SelectCommandType="StoredProcedure" OnSelecting="MyDataSource_Selecting">
<SelectParameters>
<asp:ControlParameter ControlID="respondentID" DefaultValue="%" Name="RespondentID" PropertyName="Text" Type="String" />
<asp:SessionParameter Name="projectCode" SessionField="proj" Type="String" />
<asp:ControlParameter ControlID="interviewerList" Name="InterviewerID" PropertyName="SelectedValue" Type="String" />
<asp:ControlParameter ControlID="dispCodeList" Name="dispCode" PropertyName="SelectedValue" Type="Int32" />
<asp:ControlParameter ControlID="fromDate" DefaultValue="1/1/1900" Name="startDate" PropertyName="SelectedValue" Type="DateTime" />
<asp:ControlParameter ControlID="toDate" DefaultValue="1/1/1900" Name="endDate" PropertyName="SelectedValue" Type="DateTime" />
</SelectParameters>
</asp:SqlDataSource>
Edit:
, , . DefaultValue, . datetime. . , .