I have bound a datatable
to a datagridview
and allowed the user to delete
update
, and insert
new records directly to this datagridview
Now I want to know how do I recognize newly inserted row/rows ?
I want to get new row/rows and delete
update
, or insert
them into SQL server database.
How can I do it ?
Thanks
You can do it in 2 different ways - depend on your use case:
Use this concept if you want to track the changes with multiple session per user, submit all changes to server side and track the changes datetime and save status.
Use this concept if you want to track the changes on client side regardless of the multi-session per user, basically, add 1 extra column to track the changes history -better to keep it hidden-
You can look into the DataTable.GetChanges
method https://msdn.microsoft.com/en-us/library/thc1eetk
or better look into the DataAdapter.Update
method https://docs.microsoft.com/en-us/dotnet/api/...
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.