Reflecting the changes to main table.
-
Hello All, I am developing an application with DataGridView. I have provided paging for it. What I am doing is, get the records in one main table, let the user set the page size and copy those many records to temp table. User can insert, update and delete records from using DataGridView. Now my concern is, user is playing with temp table, whatever he does is modified into temp table. I want to reflect added, changed or deleted data into original main table. I have tried Merge() but it adds all modified data into main table and when I say adapter.Update(maintable) it gives primary key violation. Any idea or workaround:(?
Jayant D. Kulkarni Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
-
Hello All, I am developing an application with DataGridView. I have provided paging for it. What I am doing is, get the records in one main table, let the user set the page size and copy those many records to temp table. User can insert, update and delete records from using DataGridView. Now my concern is, user is playing with temp table, whatever he does is modified into temp table. I want to reflect added, changed or deleted data into original main table. I have tried Merge() but it adds all modified data into main table and when I say adapter.Update(maintable) it gives primary key violation. Any idea or workaround:(?
Jayant D. Kulkarni Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET
-
Adapter.Update calls insert, update, delete in subsequent manner. Hence when I call Adapter.Update(dataTable) it throws primary key constraint failed or unique key constraints failed exception. I tried to remove some rows from main table and then again adding. But it also not working.:(
Jayant D. Kulkarni Brainbench Certified Software Engineer in C#, ASP.NET, .NET Framework and ADO.NET