Please start any new threads on our new site at https://forums.sqlteam.com. We've got lots of great SQL Server experts to answer whatever question you can come up with.

 All Forums
 Development Tools
 ASP.NET
 Procedure or function has too many arguments.

Author  Topic 

davidshq
Posting Yak Master

119 Posts

Posted - 2005-11-25 : 14:18:50
I'm getting the above message. But as far as I can tell my code is fine. Here is my aspx page:
<%@ 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="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:TemplateField HeaderText="Description" SortExpression="Description">
<EditItemTemplate>
<asp:Textbox ID="TextBox1" runat="server" TextMode="MultiLine" Text='<%# Bind("Description") %>'></asp:Textbox>
</EditItemTemplate>
</asp:TemplateField>
<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:
ALTER PROCEDURE dbo.EditGame
(
@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,
@ID as int
)
AS
UPDATE Game SET Title = @Title, Popularity = @Popularity, Description = @Description, Dangers = @Dangers, Variants = @Variants, Source = @Source, Type = @Type, Approved = @Approved WHERE @ID=ID
/* SET NOCOUNT ON */

RETURN
Thanks for any assistance.
David.

- http://www.civilwarsearch.com/
- http://www.thehungersite.com/
- http://www.grid.org/

davidshq
Posting Yak Master

119 Posts

Posted - 2005-11-25 : 22:30:36
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.civilwarsearch.com/
- http://www.thehungersite.com/
- http://www.grid.org/
Go to Top of Page
   

- Advertisement -