I want to pass variable from the code behind to the SelectCommand of a SqlDataSource?
I don't want to use built-in parameter types (like ControlParameter, QueryStringParameter, etc)
I need to pass a variable, but the following example does not work:
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:itematConnectionString %>" SelectCommand = "SELECT items.name, items.id FROM items INNER JOIN users_items ON items.id = users_items.id WHERE (users_items.user_id = @userId) ORDER BY users_items.date DESC" >
<SelectParameters>
<asp:Parameter DefaultValue="<%= userId %>" Name="userId" DbType="Guid" />
</SelectParameters>
</asp:SqlDataSource>