1

For the life of me, I can't understand this problem. Basically, I have a SqlDataSource which is refusing to return data if there are ANY select parameters. For instance;

<asp:SqlDataSource ID="sdsSubscriptions" runat="server"
    ConnectionString='<%$ ConnectionStrings:DBConnectionString %>'
    SelectCommand="SELECT ID, Description FROM Subscription.[Subscriptions">
    <SelectParameters>
        <asp:Parameter Name="UserID" Type="Int32" Direction="Input" />
    </SelectParameters>
</asp:SqlDataSource>

The above does not work. If I remove the SelectParameters, it does work.

In my actual web site, the UserID parameter is used. I arrived at the above code after reducing it to find the problem.

Does anyone know why this might be happening? Thanks

1 Answer 1

1

If SelectCommand contains no parameters, you should not specify any SelectParameters.

Sign up to request clarification or add additional context in comments.

1 Comment

Doesn't make a difference in this case - if I add 'WHERE @UserID IS NULL OR @UserID IS NOT NULL' it still doesn't work.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.