SelectParameters and SqlDataSource question

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
 
P

PlatinumBay

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
 
L

lwhitb1

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>
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top