C# 异常详细信息:System.NotSupportedException:数据源“SqlDataSourceRegister”不支持删除,除非指定了DeleteCommand

C# 异常详细信息:System.NotSupportedException:数据源“SqlDataSourceRegister”不支持删除,除非指定了DeleteCommand,c#,sql,asp.net,C#,Sql,Asp.net,当我试图在我的asp.net网站上启用删除按钮时,我遇到了这个错误,有解决方案吗?? 错误:异常详细信息:System.NotSupportedException:数据源“SqlDataSourceRegister”不支持删除,除非指定了DeleteCommand <asp:SqlDataSource ID="SqlDataSourceRegister" runat="server" ConnectionString="<%$ ConnectionStrings:RegisterCo

当我试图在我的asp.net网站上启用删除按钮时,我遇到了这个错误,有解决方案吗?? 错误:异常详细信息:System.NotSupportedException:数据源“SqlDataSourceRegister”不支持删除,除非指定了DeleteCommand

<asp:SqlDataSource ID="SqlDataSourceRegister" runat="server" ConnectionString="<%$ ConnectionStrings:RegisterConnectionString %>" SelectCommand="SELECT * FROM [Table]"></asp:SqlDataSource>
    <asp:GridView ID="GridView1" runat="server" AllowPaging="True" AllowSorting="True" AutoGenerateColumns="False" CellPadding="4" DataSourceID="SqlDataSourceRegister" ForeColor="#333333" GridLines="None" Height="195px" Width="254px" DataKeyNames="Id" OnSelectedIndexChanged="GridView1_SelectedIndexChanged">
        <AlternatingRowStyle BackColor="White" ForeColor="#284775" />
        <Columns>
            <asp:CommandField ShowSelectButton="True" />
            <asp:BoundField DataField="Id" HeaderText="Id" SortExpression="Id" ReadOnly="True" InsertVisible="False" />
            <asp:BoundField DataField="Användarnamn" HeaderText="Användarnamn" SortExpression="Användarnamn" />
            <asp:BoundField DataField="Email" HeaderText="Email" SortExpression="Email" />
            <asp:BoundField DataField="Lösenord" HeaderText="Lösenord" SortExpression="Lösenord" />
            <asp:BoundField DataField="Land" HeaderText="Land" SortExpression="Land" />
            <asp:BoundField DataField="Fullnamn" HeaderText="Fullnamn"        SortExpression="Fullnamn" />
            <asp:TemplateField ShowHeader="False">
                <ItemTemplate>
                    <asp:LinkButton ID="LinkButton1" runat="server" CausesValidation="False" CommandName="Delete" Text="Delete"></asp:LinkButton>
                </ItemTemplate>
            </asp:TemplateField>
        </Columns>
        <EditRowStyle BackColor="#999999" />
        <FooterStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <HeaderStyle BackColor="#5D7B9D" Font-Bold="True" ForeColor="White" />
        <PagerStyle BackColor="#284775" ForeColor="White" HorizontalAlign="Center" />
        <RowStyle BackColor="#F7F6F3" ForeColor="#333333" />
        <SelectedRowStyle BackColor="#E2DED6" Font-Bold="True" ForeColor="#333333" />
        <SortedAscendingCellStyle BackColor="#E9E7E2" />
        <SortedAscendingHeaderStyle BackColor="#506C8C" />
        <SortedDescendingCellStyle BackColor="#FFFDF8" />
        <SortedDescendingHeaderStyle BackColor="#6F8DAE" />
    </asp:GridView>

   </div>
  </form>
  </body>
  </html>

我认为您需要添加一个DeleteCommand,就像您在[Table]中添加了SelectCommand=SELECT*