SelectParameters and SqlDataSource question

  • Thread starter Thread starter Jason Huang
  • Start date Start date
J

Jason Huang

Hi,

Here is my SqlDataSource in my C#.2.0 aspx file:
<asp:SqlDataSource ID="SqlDataSourceA" runat="server" ConnectionString="<%$
ConnectionStrings:GConnectionStringA %>"
SelectCommand="SELECT TestNo, AcceptDate, status FROM TestForm
WHERE (AcceptDate BETWEEN @prAcceptDate AND @prAcceptDateEnd)"
ProviderName="<%$
ConnectionStrings:GConnectionStringA.ProviderName %>"
EnableViewState="False">
<SelectParameters>
<asp:Parameter Name="prAcceptDateStart" />
<asp:Parameter Name="prAcceptDateEnd" />
</SelectParameters>
</asp:SqlDataSource>

In the same aspx file I have DropDownList controls ddlStartYear,
ddlStartMonth, ddlStartDay, ddlEndYear, ddlEndMonth, and ddlEndDay.
My question is how do I let the Parameter prAcceptDateStart to be the
combination of ddlStartYear+ddlStartMonth+ddlddlStartDay?
Thanks for hlep.


Jason
 
Jason,

There is no real way to do this with the DropDownList control. You may want
to consider creating a calculated column in your query, or changing the
underlying dataset before you bind it.

Hope this helps,


Steve
 
Jason,

There is no real way to do this with the DropDownList control. You may want
to consider creating a calculated column in your query, or changing the
underlying dataset before you bind it.

Hope this helps,

Steve









- Show quoted text -

You could also store the combination(ddlStartYear+ddlStartMonth
+ddlStartDay) into a Session Variable, and make your AcceptDateStart a
Session Parameter. Something Like below:

<SelectParameters>
<asp:SessionParameter Name=" prAcceptDateStart"
SessionField="CombinationDateSession" />
</SelectParameters>
 
Back
Top