Home All Groups Group Topic Archive Search About

SqlDataSource UpdateParameters supplies wrong number of params to storedproc

Author
21 Nov 2005 9:00 PM
dotnw
If I try and update an SqlDataSource inside a DetailsView control,
using a stored procedure, I get this error -

Procedure or function DataViews_UpdateDetails has too many arguments
specified

However, if I just simply remove the stored procedure call, and use
"inline" sql instead, and leave the UpdateParameters totally unchanged,
and the sql totally unchanged as well (just copy it from the stored
proc to the html section), it works fine, and there are no errors.

Any ideas very welcome, thanks, regards, dnw.

Author
22 Nov 2005 8:43 AM
Miha Markic [MVP C#]
Sounds to me that stored procedure requires less parameters?
What is the definition of SP and what is your code?

--
Miha Markic [MVP C#]
RightHand .NET consulting & development www.rthand.com
Blog: http://cs.rthand.com/blogs/blog_with_righthand/

<do***@hotmail.com> wrote in message
Show quote
news:1132606851.951267.3120@z14g2000cwz.googlegroups.com...
> If I try and update an SqlDataSource inside a DetailsView control,
> using a stored procedure, I get this error -
>
> Procedure or function DataViews_UpdateDetails has too many arguments
> specified
>
> However, if I just simply remove the stored procedure call, and use
> "inline" sql instead, and leave the UpdateParameters totally unchanged,
> and the sql totally unchanged as well (just copy it from the stored
> proc to the html section), it works fine, and there are no errors.
>
> Any ideas very welcome, thanks, regards, dnw.
>
Author
22 Nov 2005 12:24 PM
dotnw
The sp is

ALTER PROCEDURE [dbo].[DataViews_UpdateDetails]
    @vcDetails varchar(50),
    @cExtraDetails1 char(10),
    @cExtraDetails2 char(10),
    @cExtraDetails3 char(10),
    @original_iId int,
    @original_vcDetails varchar(50),
    @original_cExtraDetails1 char(10),
    @original_cExtraDetails2 char(10),
    @original_cExtraDetails3 char(10)
AS
BEGIN
    -- SET NOCOUNT ON added to prevent extra result sets from
    -- interfering with SELECT statements.
    SET NOCOUNT ON;

    UPDATE DataViews_Details
    SET vcDetails = @vcDetails, cExtraDetails1 = @cExtraDetails1,
    cExtraDetails2 = @cExtraDetails2, cExtraDetails3 = @cExtraDetails3
    WHERE iId = @original_iId AND
    vcDetails = @original_vcDetails AND
    cExtraDetails1 = @original_cExtraDetails1 AND
    cExtraDetails2 = @original_cExtraDetails2 AND
    cExtraDetails3 = @original_cExtraDetails3
END

And the UpdateParameters is

<UpdateParameters>
                <asp:Parameter Name="vcDetails" Type="String" />
                <asp:Parameter Name="cExtraDetails1" Type="String" />
                <asp:Parameter Name="cExtraDetails2" Type="String" />
                <asp:Parameter Name="cExtraDetails3" Type="String" />
                <asp:Parameter Name="original_iId" Type="Int32" />
                <asp:Parameter Name="original_vcDetails" Type="String"
/>
                <asp:Parameter Name="original_cExtraDetails1"
Type="String" />
                <asp:Parameter Name="original_cExtraDetails2"
Type="String" />
                <asp:Parameter Name="original_cExtraDetails3"
Type="String" />
            </UpdateParameters>

There is actually no code at all.

Thanks, regards, dnw.

AddThis Social Bookmark Button