Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 228
  • Last Modified:

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

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:

Me.CustomerTableAdapter.Update(Me.DealerDataSet.Customer)

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

Thank you.

0
Tom Sage
Asked:
Tom Sage
  • 2
1 Solution
 
rajeeshmcaCommented:
HI,

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
next

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

-------------------------------------------------------------------------------------------------
http://msdn.microsoft.com/en-us/library/thc1eetk%28VS.80%29.aspx
http://msdn.microsoft.com/de-de/library/system.data.datatable.select%28VS.80%29.aspx
http://msdn.microsoft.com/en-us/library/a4ey25we.aspx
http://msdn.microsoft.com/en-us/library/system.data.dataset.getchanges.aspx


0
 
Tom SageAuthor Commented:
This looks like what I want.  I will try a few tests and let you know.

Thank you
0
 
Tom SageAuthor Commented:
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.
0

Featured Post

Transaction-level recovery for Oracle database

Veeam Explore for Oracle delivers low RTOs and RPOs with agentless transaction log backup and transaction-level recovery of Oracle databases. You can restore the database to a precise point in time, even to a specific transaction.

  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now