Forum Moderators: open
I'm still plugging away on my asp.net app-- and I am trying to build a simple query that will grab some data based on the input from a drop down.
However, the parameter never gets set-- and I get SQL Server errors, since the query is invalid without the parameters being set.
Error:
Each GROUP BY expression must contain at least one column that is not an outer reference.
Here's my query and the param that never gets set-- I figured that if I set a default value it ought to work whether or not the dropdown control is working, right?
<asp:SqlDataSource ID="root" runat="server"
ConnectionString="<%$ ConnectionStrings:Stats_DevConnectionString %>"
SelectCommand="SELECT @view_type,COUNT([UniqueVisitors]) as u_visitors,
COUNT([Visits]) as visits,
COUNT([PageViews]) as pageviews
FROM [Report_WebPagesByProperty]
GROUP BY @view_type">
<SelectParameters>
<asp:ControlParameter Name="view_type" ControlID="DropDownList1" Type="String" PropertyName="SelectedValue" DefaultValue="Root" />
</SelectParameters>
</asp:SqlDataSource>
Thanks for any clues.