I have a dropdown in my application, which should be filled with values which are based on a session variable.
<asp:SqlDataSource
id="SqlDataSource3"
runat="server"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT ID_SHOP
FROM SHOP
WHERE ID_SHOP_CITY = ?">
<SelectParameters>
<asp:SessionParameter
Name="selectedCityId"
SessionField="selectedCityId"
DefaultValue="5" />
</SelectParameters>
</asp:SqlDataSource>
based on this example: http://msdn.microsoft.com/en-us/library/system.web.ui.webcontrols.sessionparameter.aspx
I get syntax error - invalid character.
If I change my code:
<asp:SqlDataSource
id="SqlDataSource3"
runat="server"
ProviderName="<%$ ConnectionStrings:ConnectionString.ProviderName %>"
ConnectionString="<%$ ConnectionStrings:ConnectionString %>"
SelectCommand="SELECT ID_SHOP
FROM SHOP
WHERE ID_SHOP_CITY = 1">
<SelectParameters>
<asp:SessionParameter
Name="selectedCityId"
SessionField="selectedCityId"
DefaultValue="5" />
</SelectParameters>
</asp:SqlDataSource>
and it works. However I don't need that where clause, I need to use the session variable. How can I fix it?
= 1to= @selectedCityId;