Web Wiz - Solar Powered Eco Hosting

  New Posts New Posts RSS Feed - Procedure or Function - Too Many Argument
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Procedure or Function - Too Many Argument

 Post Reply Post Reply
Author
davidshq View Drop Down
Senior Member
Senior Member


Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidshq Quote  Post ReplyReply Direct Link To This Post Topic: Procedure or Function - Too Many Argument
    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
Back to Top
davidshq View Drop Down
Senior Member
Senior Member


Joined: 29 July 2003
Location: United States
Status: Offline
Points: 299
Post Options Post Options   Thanks (0) Thanks(0)   Quote davidshq Quote  Post ReplyReply Direct Link To This Post 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.
Back to Top
 Post Reply Post Reply
  Share Topic   

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.01
Copyright ©2001-2018 Web Wiz Ltd.


Become a Fan on Facebook Follow us on Twitter Connect with us on LinkedIn Community Forums Web Wiz Blogs Web Wiz News
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Policy

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2019 Web Wiz Ltd. All rights reserved.