Print Page | Close Window

Procedure or Function - Too Many Argument

Printed From: Web Wiz Forums
Category: General Discussion
Forum Name: ASP.NET Discussion
Forum Description: Discussion and chat on ASP.NET related topics.
URL: https://forums.webwiz.net/forum_posts.asp?TID=17347
Printed Date: 28 March 2026 at 9:41pm
Software Version: Web Wiz Forums 12.08 - https://www.webwizforums.com


Topic: Procedure or Function - Too Many Argument
Posted By: davidshq
Subject: Procedure or Function - Too Many Argument
Date Posted: 25 November 2005 at 6:25pm
GameSecretary.Com is up and running, but now I am working on the Administrative side. One of the features I wanted to add was the ability to easily edit game's information. So I dropped a DetailsView onto a page, bound it to my database and began viewing the events. But when I click update it gives me a "Procedure or function EditGame has too many arguments specified." EditGame is the name of my stored procedure. But I can't find anything wrong with my code. Here is the page code:
<%@ Page Language="VB" MasterPageFile="~/Admin.master" AutoEventWireup="false" CodeFile="EditDetailGames.aspx.vb" Inherits="Admin_EditDetailGames" title="Untitled Page" %>
<asp:Content ID="Content1" ContentPlaceHolderID="ContentPlaceHolder1" Runat="Server">
   <asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$ ConnectionStrings:databaseConnectionString %>" SelectCommand="SELECT * FROM [Game]"
   UpdateCommand="UPDATE Game SET [Title] = @Title, [Popularity] = @Popularity, [Description] = @Description, [Dangers] = @Dangers, [Variants] = @Variants, [Source] = @Source, [Type] = @Type, [Approved] = @Approved WHERE ID=@ID">
       <UpdateParameters>
           <asp:Parameter Name="Title" Type="String" />
           <asp:Parameter Name="Popularity" Type="Int16" />
           <asp:Parameter Name="Description" Type="String" />
           <asp:Parameter Name="Dangers" Type="String" />
           <asp:Parameter Name="Variants" Type="String" />
           <asp:Parameter Name="Source" Type="String" />
           <asp:Parameter Name="Type" Type="Int16" />
           <asp:Parameter Name="Approved" Type="Int16" />
       </UpdateParameters>
        </asp:SqlDataSource>
    <asp:SqlDataSource ID="SqlDataSource2" runat="server" ConnectionString="<%$ ConnectionStrings:TestdatabaseConnectionString %>"
        SelectCommand="SELECT * FROM [Game]"
        UpdateCommandType="StoredProcedure" UpdateCommand="EditGame">
        <UpdateParameters>
           <asp:Parameter Name="ID" Type="Int16" />
           <asp:Parameter Name="Title" Type="String" />
           <asp:Parameter Name="Popularity" Type="Int16" />
           <asp:Parameter Name="Description" Type="String" />
           <asp:Parameter Name="Dangers" Type="String" />
           <asp:Parameter Name="Variants" Type="String" />
           <asp:Parameter Name="Source" Type="String" />
           <asp:Parameter Name="Type" Type="Int16" />
           <asp:Parameter Name="Approved" Type="Int16" />
       </UpdateParameters>
        </asp:SqlDataSource>
    <br />
    <asp:DetailsView ID="DetailsView1" runat="server" AllowPaging="True" AutoGenerateDeleteButton="True"
        AutoGenerateEditButton="True" AutoGenerateInsertButton="True" AutoGenerateRows="False"
        BackColor="White" BorderColor="#DEDFDE" BorderStyle="None" BorderWidth="1px"
        CellPadding="4" DataSourceID="SqlDataSource2" DefaultMode="Edit" ForeColor="Black"
        GridLines="Vertical" Height="50px" Width="423px" DataKeyNames="ID">
        <FooterStyle BackColor="#CCCC99" />
        <EditRowStyle BackColor="#CE5D5A" Font-Bold="True" ForeColor="White" />
        <RowStyle BackColor="#F7F7DE" />
        <PagerStyle BackColor="#F7F7DE" ForeColor="Black" HorizontalAlign="Right" />
        <Fields>
            <asp:BoundField DataField="ID" HeaderText="ID" ReadOnly="True"
                SortExpression="ID" />
            <asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title" />
            <asp:BoundField DataField="Popularity" HeaderText="Popularity" SortExpression="Popularity" />
            <asp:BoundField DataField="YourPopularity" HeaderText="YourPopularity" SortExpression="YourPopularity" />
            <asp:BoundField DataField="Description" HeaderText="Description" SortExpression="Description" />
            <asp:BoundField DataField="Dangers" HeaderText="Dangers" SortExpression="Dangers" />
            <asp:BoundField DataField="Variants" HeaderText="Variants" SortExpression="Variants" />
            <asp:BoundField DataField="Source" HeaderText="Source" SortExpression="Source" />
            <asp:BoundField DataField="Last Played" HeaderText="Last Played" SortExpression="Last Played" />
            <asp:BoundField DataField="Type" HeaderText="Type" SortExpression="Type" />
            <asp:BoundField DataField="Approved" HeaderText="Approved" SortExpression="Approved" />

        </Fields>
        <HeaderStyle BackColor="#6B696B" Font-Bold="True" ForeColor="White" />
        <AlternatingRowStyle BackColor="White" />
    </asp:DetailsView>
</asp:Content>
Here is my stored procedure code:
ALTER PROCEDURE dbo.EditGame
    (
    @ID as int,
    @Title as varchar(200),
    @Popularity as int,
    @Description as varchar(8000),
    @Dangers as varchar(8000),
    @Variants as varchar(8000),
    @Source as varchar(500),
    @Type as int,
    @Approved as int
    )
AS
    UPDATE Game SET Title = @Title, Popularity = @Popularity, Description = @Description, Dangers = @Danger

-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.



Replies:
Posted By: davidshq
Date Posted: 25 November 2005 at 6:49pm
Okay, I fixed it. I can't believe it. The problem was that I had called more columsn in the Select statement than I Updated in the Update statement. :-P How horrible is that?
David.


-------------
- http://www.davemackey.net/" rel="nofollow - Dave Mackey - Virtual Home.



Print Page | Close Window

Forum Software by Web Wiz Forums® version 12.08 - https://www.webwizforums.com
Copyright ©2001-2026 Web Wiz Ltd. - https://www.webwiz.net