没有给出一个或多个必需参数的值。显示错误

时间:2011-06-23 12:27:15

标签: asp.net sql vb.net

 <asp:AccessDataSource ID="productsubtype" Runat="server" DataFile="~/access_db/db_tables.mdb" 

            SelectCommand="SELECT [type], [id],[subtype] FROM [prod_subtype]"


               UpdateCommand="UPDATE [prod_subtype] SET [subtype]=@subtype WHERE [id]=@id"
                DeleteCommand="DELETE FROM [prod_subtype] WHERE [id]=@id" 
                FilterExpression="type='{0}'">


                <UpdateParameters>

                    <asp:Parameter Name="subtype" Type="string" />
                </UpdateParameters>
                <DeleteParameters>
                    <asp:Parameter Name="id" Type="string" />
                </DeleteParameters>
                 <FilterParameters>
                <asp:ControlParameter Name="type" DefaultValue="-1" 
                   Type="String" ControlID="gdproducttype"
                    PropertyName="SelectedValue"></asp:ControlParameter>
            </FilterParameters>
        </asp:AccessDataSource>

当我在gridview中按删除按钮时,我收到错误

1 个答案:

答案 0 :(得分:0)

尝试将UpdateParameters更改为以下内容:

<UpdateParameters>
    <asp:Parameter Name="id" Type="string" />
    <asp:Parameter Name="subtype" Type="string" />
</UpdateParameters>