DataGridView - How to know number of Inserts when saving using TableAdapter?

Posted on 2009-12-18
Last Modified: 2013-11-07
I have a DataGridView control that I am using to input data for a Table.  I am using the following code to update the table:


I would like to know which of the changes were Inserts.  Is there a way I can tell?

Thank you.

Question by:MisterT25
    LVL 15

    Accepted Solution


    Yes... you can find which of the rows are inserts like

    dim i as integer
    for i = 0  to DealerDataSet.Customer.Count
    If DealerDataSet.Customer.Rows(i).RowState = DataRowState.Added Then

    End If

    you can user DataRowVersion.Original, DataRowVersion.Current etc.. to find the old and the new value during update

    for more details
    Refer the following link



    Author Comment

    This looks like what I want.  I will try a few tests and let you know.

    Thank you

    Author Closing Comment

    I have not been able to totally change my program, I can see that this gives me the information I need to identify which rows were changed.

    Thank you for your quick response.

    Featured Post

    How your wiki can always stay up-to-date

    Quip doubles as a “living” wiki and a project management tool that evolves with your organization. As you finish projects in Quip, the work remains, easily accessible to all team members, new and old.
    - Increase transparency
    - Onboard new hires faster
    - Access from mobile/offline

    Join & Write a Comment

    For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK ( for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
    Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
    Sending a Secure fax is easy with eFax Corporate ( First, Just open a new email message.  In the To field, type your recipient's fax number You can even send a secure international fax — just include t…
    This video discusses moving either the default database or any database to a new volume.

    734 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    23 Experts available now in Live!

    Get 1:1 Help Now