Select parameter not working on SqlDataSource.

Posted by ProfK on Stack Overflow See other posts from Stack Overflow or by ProfK
Published on 2010-04-18T14:53:19Z Indexed on 2010/04/18 15:23 UTC
Read the original article Hit count: 623

Filed under:
|

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

© Stack Overflow or respective owner

Related posts about ASP.NET

Related posts about sqldatasource