locked
sqldatasource keeps telling me parameter is missing, but it is not. RRS feed

  • Question

  • User297437924 posted

    I have a sql data source with parameters as follows:

    <SelectParameters>
                        <asp:Parameter DefaultValue="0" Name="IDst" Type="Int32" />
                        <asp:SessionParameter DefaultValue="0" Name="videoid" SessionField="videoid_zUser" Type="Int32" />
                        <asp:SessionParameter DefaultValue="0" Name="currentwatcherid" SessionField="watcherid" Type="Int32" />
                          <asp:SessionParameter DefaultValue="0" Name="showFirstAndLastName" SessionField="showFirstAndLastName" Type="Boolean" />
                                            <asp:Parameter DefaultValue="true"  Name="OnlyShowOtherDocsIfHaveto" Type="Boolean" />
                    </SelectParameters>

    This calls a sql server procedure whose arguments are:

    ALTER PROCEDURE [dbo].[GetHighlightAnswersGivenVideoid]
    @IDst int,
    @videoid int,
    @showfirstandlastname bit,
    @currentwatcherid int,
    @OnlyShowOtherDocsIfHaveto bit

    When the page calls it, though, I get the following message:

    Database Error: Please wait a few seconds, and try again -- Procedure or function 'GetHighlightAnswersGivenVideoid' expects parameter 
    '@OnlyShowOtherDocsIfHaveto', which was not supplied.

    I don't understand this.  The parameter is obviously supplied, and I've done a global search through the solution and this is the only call in this page

    Sunday, February 19, 2017 10:33 PM

Answers

  • User297437924 posted

    I just found out that my parameter had a space between it and the quotes around it.  That was the problem.   The code I show above was not the code causing the error.

    Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 20, 2017 10:09 AM

All replies

  • User-1716253493 posted

    Have you set selectcommandtype to sp?

    SelectCommandType="StoredProcedure"

    Monday, February 20, 2017 1:15 AM
  • User297437924 posted

    I just found out that my parameter had a space between it and the quotes around it.  That was the problem.   The code I show above was not the code causing the error.

    Thanks.

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Monday, February 20, 2017 10:09 AM