none
Multiple datarows deletion using .Net code RRS feed

  • Question

  • How do I delete multiple rows using dataset (.xsd) class which has a tableadapter class (generated automatically on creation of the dataset class using stored procedure)? The table adapter has select, insert, update and delete command.

    I want to be able

    1. to select one or more rows from devexpress gridview and click delete button;

    2. and then perform other gridview modifications....and after adding all the changes to the gridview (which is in a windows form) I can hit the 'Update'    button which will commit all the changes to the database, deleting selected records, updating other records.

    I understand I can call the delete procedure in a seperate event but is it possible to have this done at the same time?

    Thanks.

    • Moved by Leo Liu - MSFT Tuesday, January 24, 2012 7:01 AM Moved for better support. (From:Visual C# General)
    Monday, January 23, 2012 5:09 PM

Answers

  • Hi,

    Do you mean you want to delete batch of data rows in a winform app which uses typed dataset databinding?   As far as I remember, TableAdapter has several Update methods which are auto-generated in the typed dataset designer source codes, and Update methods accept parameters like DataTable, DataSet, DataRows, an array of DataRows and even a single datarow's values. 

    Also, we can use TableAdapterManager if we need to handle multiple related tables in a single dataset, http://msdn.microsoft.com/en-us/library/bb384432.aspx.   And here is the document for your references if you want to update the related tables manually using TableAdapter, http://msdn.microsoft.com/en-us/library/4esb49b4.aspx.    I think both the documents demostrate how to do all the updates when we press some "Update" button.

    Or if I misunderstand your request, please correct me and provide me with the detailed information.

    Good day!

    Thanks


    Michael Sun [MSFT]
    MSDN Community Support | Feedback to us
    Tuesday, January 24, 2012 8:17 AM
    Moderator

All replies