none
GridView 为过程或函数 Pr_ProductUnitUpdate 指定了过多的参数 RRS feed

  • 问题

  • <asp:GridView ID="GridView1" runat="server" AllowPaging="True" 
                AllowSorting="True" AutoGenerateColumns="False" BackColor="White" 
                BorderColor="White" BorderStyle="Ridge" BorderWidth="2px" CellPadding="3" 
                CellSpacing="1" DataKeyNames="id" DataSourceID="SqlDataSourceProductUnit" 
                GridLines="None" Width="550px" onrowdatabound="GridView1_RowDataBound">
                <RowStyle BackColor="#DEDFDE" ForeColor="Black" />
                
                <Columns>
                  <asp:BoundField HeaderText="行号" ItemStyle-HorizontalAlign="Center" >
                    <ItemStyle HorizontalAlign="Center" Width="50px" Height="20px"></ItemStyle>
                  </asp:BoundField>
                  <asp:BoundField DataField="Unit" HeaderText="单位名称" SortExpression="Unit">
                    <ItemStyle HorizontalAlign="Center" Width="150px"></ItemStyle>
                  </asp:BoundField>
                  <asp:CommandField ShowEditButton="True" HeaderText="编 辑">
                    <ItemStyle HorizontalAlign="Center" Width="200px"></ItemStyle>
                  </asp:CommandField>
                  <asp:CommandField ShowDeleteButton="True" HeaderText="删 除">
                    <ItemStyle HorizontalAlign="Center" Width="150px"></ItemStyle>
                  </asp:CommandField>
                </Columns>
                <FooterStyle BackColor="#C6C3C6" ForeColor="Black" />
                <PagerStyle BackColor="#C6C3C6" ForeColor="Black" HorizontalAlign="Center" />
                <SelectedRowStyle BackColor="#9471DE" Font-Bold="True" ForeColor="White" />
                <HeaderStyle BackColor="#4A3C8C" Font-Bold="True" ForeColor="#E7E7FF" />
              </asp:GridView>
    
              <asp:SqlDataSource ID="SqlDataSourceProductUnit" runat="server" 
                ConnectionString="<%$ ConnectionStrings:SystemConnectionString %>" 
                SelectCommand="Pr_ProductUnitSelectByUnit" 
                SelectCommandType="StoredProcedure" UpdateCommand="Pr_ProductUnitUpdate" 
                UpdateCommandType="StoredProcedure" DeleteCommand="Pr_ProductUnitDelete" 
                DeleteCommandType="StoredProcedure">
                <SelectParameters>
                  <asp:Parameter Name="unit" Type="String" DefaultValue=" " />
                </SelectParameters>
                <DeleteParameters>
                  <asp:Parameter Name="id" Type="Int32" />
                </DeleteParameters>
                <UpdateParameters>
                  <asp:Parameter Name="id" Type="Int32" />
                  <asp:Parameter Name="Unit" Type="String" />
                </UpdateParameters>
              </asp:SqlDataSource>
    
    存储过程如下:
    Create Proc [dbo].[Pr_ProductUnitUpdate]
      @id int,
      @Unit varchar(20)
    As
    Begin
      update ProductUnit set Unit=@Unit where id=@id
    End
    
    存储过程确实只有两个参数,为什么还提示参数过多


    由于直接使用SqlDataSource 的属性,所以不知从何开始调试 ASPX文件里没法设置断点

    请问如何解决,谢谢
    2010年7月2日 20:19

全部回复