Procedure or function has too many arguments specified

Discussion in 'ASP .Net' started by David Lozzi, Mar 2, 2007.

  1. David Lozzi

    David Lozzi Guest

    Howdy,

    ASP.Net 2.0 using VB on SQL 2005

    This is a two fold issue.

    I have a DetailsView control which users can insert or edit items. Editing
    works great. Insert works great however I need to display the form once the
    user has entered the information and clicked Add.

    1) Trying to get the record ID of the inserted record. ReturnValue doesnt
    appear to work properly so i'm using an OUTPUT value instead. I get Null
    reference errors when working with RETURN SCOPE_IDENTITY()

    2) Getting "Procedure or function cp_InsertPublication has too many
    arguments specified" error when trying to insert. See code below. All
    parameters match up fine.


    Thanks!!

    David Lozzi


    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
    ConnectionString="<%$ ConnectionStrings:SMALLConnectionString %>"
    DeleteCommand="DELETE FROM [tblPublications] WHERE [ID] = @ID"
    InsertCommand="cp_InsertPublication"
    InsertCommandType="StoredProcedure"
    SelectCommand="SELECT * FROM [tblPublications] WHERE ([ID] =
    @ID)"
    UpdateCommand="UPDATE [tblPublications] SET [strName] =
    @strName, [dtDate] = @dtDate, [strPDF] = @strPDF, [intPages] = @intPages,
    [strWrittenBy] = @strWrittenBy, [intType] = @intType, [dtModified] = {fn
    Now()} WHERE [ID] = @ID">
    <DeleteParameters>
    <asp:parameter Name="ID" Type="Int32" />
    </DeleteParameters>
    <UpdateParameters>
    <asp:parameter Name="strName" Type="String" />
    <asp:parameter Name="dtDate" Type="DateTime" />
    <asp:parameter Name="intPages" Type="Int32" />
    <asp:parameter Name="strWrittenBy" Type="String" />
    <asp:parameter Name="dtAdded" Type="DateTime" />
    <asp:parameter Name="dtModified" Type="DateTime" />
    <asp:parameter Name="intType" Type="int32" />
    <asp:ControlParameter Name="strPDF"
    ControlID="dvDetails$Label5" PropertyName="Text" />
    <asp:parameter Name="ID" Type="Int32" />
    </UpdateParameters>
    <SelectParameters>
    <asp:QueryStringParameter Name="ID" QueryStringField="PID"
    Type="Int32" />
    </SelectParameters>
    <InsertParameters>
    <asp:parameter Name="strName" Type="String" />
    <asp:parameter Name="dtDate" Type="DateTime" />
    <asp:parameter Name="intPages" Type="Int32" />
    <asp:parameter Name="strWrittenBy" Type="String" />
    <asp:parameter Name="intType" Type="int32" />
    <asp:parameter Name="returnValue" Type="int32"
    Direction="output" />
    </InsertParameters>
    </asp:SqlDataSource>



    set ANSI_NULLS ON
    set QUOTED_IDENTIFIER ON
    GO

    ALTER PROCEDURE [dbo].[cp_InsertPublication]
    @strName as varchar(500),
    @dtDate as datetime,
    @intPages as int,
    @strWrittenBy as varchar(50),
    @intType as int,
    @returnValue as int OUTPUT
    AS

    INSERT INTO [tblPublications]
    ([strName], [dtDate], [intPages], [strWrittenBy], [intType], [dtAdded],
    [dtModified])
    VALUES
    (@strName, @dtDate, @intPages, @strWrittenBy, @intType, {fn Now()}, {fn
    Now()})

    SET @returnValue = SCOPE_IDENTITY()
    David Lozzi, Mar 2, 2007
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Mike P
    Replies:
    0
    Views:
    3,267
    Mike P
    Jun 19, 2006
  2. Mike
    Replies:
    3
    Views:
    474
  3. Seth Williams
    Replies:
    1
    Views:
    558
    Seth Williams
    Sep 16, 2008
  4. John Smith

    Procedure or function has too many arguments specified

    John Smith, Jun 29, 2005, in forum: ASP .Net Web Controls
    Replies:
    0
    Views:
    133
    John Smith
    Jun 29, 2005
  5. c676228
    Replies:
    2
    Views:
    164
    c676228
    Sep 14, 2006
Loading...

Share This Page