0

I am using the stored procedure below for the select command of a SqlDataSource, and I'm trying to pass a query string parameter, but I get this error:

Procedure or function 'ActivationCampaignGetById' expects parameter '@campaignId', which was not supplied.

The parameter is present in the query string:

http://localhost:62681/Activations/ActivationCampaignDetails.aspx?id=98

Here is my DataSource code:

<asp:SqlDataSource ID="campaignDataSource" runat="server" ConflictDetection="CompareAllValues"
    ConnectionString="<%$ ConnectionStrings:ProVantageMediaManagement %>" 
    SelectCommand="ActivationCampaignGetById" SelectCommandType="StoredProcedure">
    <SelectParameters>
        <asp:QueryStringParameter DefaultValue="98" Name="campaignId" 
            QueryStringField="id" Type="Int32" />
    </SelectParameters>
</asp:SqlDataSource>

And my stored procedure declaration:

ALTER procedure [dbo].[ActivationCampaignGetById]
    @campaignId int
as
select

1 Answer 1

4

Not sure this will helps, but you need to set the parameter direction to Input:

<asp:QueryStringParameter DefaultValue="98" Name="campaignId" 
       Direction="Input" QueryStringField="id" Type="Int32" />
Sign up to request clarification or add additional context in comments.

Comments

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.