deleting row from gridview

前端 未结 1 1085
小鲜肉
小鲜肉 2021-01-27 00:52

I have 2 tables MachineGroups and Machines. MachineGroups has columns:

MachinegroupID
MachineGroupName
MachineGroupDesc

And Machines has column

相关标签:
1条回答
  • 2021-01-27 01:36

    Not tested, but the direction should be right:

    <asp:SqlDataSource ID="SqlDataSource1" runat="server"
        ConnectionString="<%$ ConnectionStrings:SumooHAgentDBConnectionString %>" 
        SelectCommand="SELECT MachineGroups.MachineGroupID, MachineGroups.MachineGroupName, MachineGroups.MachineGroupDesc, MachineGroups.TimeAdded, MachineGroups.CanBeDeleted, COUNT(Machines.MachineName) AS 'No. of PCs' FROM MachineGroups FULL OUTER JOIN Machines ON Machines.MachineGroupID = MachineGroups.MachineGroupID GROUP BY MachineGroups.MachineGroupID, MachineGroups.MachineGroupName, MachineGroups.MachineGroupDesc, MachineGroups.TimeAdded, MachineGroups.CanBeDeleted" 
        DeleteCommand="DELETE FROM MachineGroups WHERE MachineGroupID = @MachineGroupID">
        <DeleteParameters>
            <asp:Parameter Name="MachineGroupID" />
        </DeleteParameters>
    </asp:SqlDataSource>
    
    0 讨论(0)
提交回复
热议问题