我一直在网上搜索几个小时,试图找出造成这种异常的原因,我觉得我错过了一些东西......
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title></title>
</head>
<body>
<form id="form1" runat="server">
<div>
<asp:GridView ID="GridView1" runat="server" AutoGenerateColumns="False"
BackColor="White" BorderColor="#999999" BorderStyle="None"
BorderWidth="1px" CellPadding="3" DataKeyNames="ProductID"
DataSourceID="SqlDataSource1"
GridLines="Vertical">
<AlternatingRowStyle BackColor="#DCDCDC" />
<Columns>
<asp:CommandField ShowEditButton="True" />
<asp:BoundField DataField="ProductID" HeaderText="ProductID"
InsertVisible="False" ReadOnly="True" SortExpression="ProductID" />
<asp:BoundField DataField="CategoryID" HeaderText="CategoryID"
SortExpression="CategoryID" />
<asp:BoundField DataField="Title" HeaderText="Title" SortExpression="Title"
/>
<asp:BoundField DataField="ShortDescription" HeaderText="ShortDescription"
SortExpression="ShortDescription" />
<asp:BoundField DataField="LongDescription" HeaderText="LongDescription"
SortExpression="LongDescription" />
<asp:BoundField DataField="ImageUrl" HeaderText="ImageUrl"
SortExpression="ImageUrl" />
<asp:BoundField DataField="Price" HeaderText="Price" SortExpression="Price"
/>
</Columns>
<FooterStyle BackColor="#CCCCCC" ForeColor="Black" />
<HeaderStyle BackColor="#000084" Font-Bold="True" ForeColor="White" />
<PagerStyle BackColor="#999999" ForeColor="Black" HorizontalAlign="Center" />
<RowStyle BackColor="#EEEEEE" ForeColor="Black" />
<SelectedRowStyle BackColor="#008A8C" Font-Bold="True" ForeColor="White" />
<SortedAscendingCellStyle BackColor="#F1F1F1" />
<SortedAscendingHeaderStyle BackColor="#0000A9" />
<SortedDescendingCellStyle BackColor="#CAC9C9" />
<SortedDescendingHeaderStyle BackColor="#000065" />
</asp:GridView>
<asp:DropDownList ID="DropDownList1" runat="server" DataSourceID="SqlDataSource2"
DataTextField="Title" DataValueField="CategoryID">
</asp:DropDownList>
<asp:SqlDataSource ID="SqlDataSource2" runat="server"
ConnectionString="<%$ ConnectionStrings:s3435926ConnectionString %>"
SelectCommand="SELECT [CategoryID], [Title] FROM [Category]">
</asp:SqlDataSource>
<asp:SqlDataSource ID="SqlDataSource1" runat="server" ConnectionString="<%$
ConnectionStrings:s3435926ConnectionString %>"
SelectCommand="SelectProductsWithParam" SelectCommandType="StoredProcedure"
UpdateCommand="UpdateProdsWithParam" UpdateCommandType="StoredProcedure">
<SelectParameters>
<asp:FormParameter FormField="DropDownList1" Name="prodID" Type="Int32" />
</SelectParameters>
<UpdateParameters>
<asp:Parameter Name="prodID" Type="Int32" />
<asp:Parameter Name="CatID" Type="Int32" />
<asp:Parameter Name="title" Type="String" />
<asp:Parameter Name="Sdesc" Type="String" />
<asp:Parameter Name="Ldesc" Type="String" />
<asp:Parameter Name="url" Type="String" />
<asp:Parameter Name="price" Type="Decimal" />
</UpdateParameters>
</asp:SqlDataSource>
<asp:Button ID="Button1" runat="server" OnClick="Button1_Click" Text="Button" />
</div>
</form>
</body>
</html>
SP
[dbo].[UpdateProdsWithParam] @prodID int, @CatID int, @title nvarchar(50),
@Sdesc nvarchar(100), @Ldesc nvarchar(200),
@url nvarchar(50), @price money
AS
UPDATE Product
SET CategoryID = @CatID, Title = @title,
ShortDescription = @Sdesc, LongDescription = @Ldesc,
ImageUrl = @url, Price = @price
WHERE ProductID = @prodID
我得到'过程或函数指定了太多参数'
有什么建议吗?
答案 0 :(得分:0)
分享您的C#代码。错误清楚地表明您传递了太多参数。查看您的参数数量&amp;参数名称。