Click here to Skip to main content
15,892,161 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi
I explain my problem with an example. (Entity Framework and VB.net 2012)

I have two DataGridViews in my form. first DGV populated from a table in SQL (datasource) and second DGV datasource is an empty table in SQL (By Entitiy Faramwork). user must selects some records from DGV1 and sends them to DGV2 by clicking on a button.

and what is the problem?

when user sends some records from DGV1 to DGV2, transferred records must eliminate from DGV1 without any change on SQL tables. changes finally will be saved by a button clicking.

How can create this relation between DGV1 and DGV2 datasources with out any change to main data in SQL??

I can do this easily in MS Access but i cant do this in EF.

Any help will be greatly appreciated.
Posted

1 solution

It's easy if you think about it. Since you need to keep the data in SQL, you have to keep it's data in a DataTable. You then bind DGV1 to it. When you select the record in DGV1 to tranfer and hit the button, you simply take the data in the selected row and create new EF entities with it, then remove that row from the DataTable. You can then add the new entities to a collection and bind DGV2 to it.
 
Share this answer
 
Comments
r. salehi 25-May-13 10:38am    
Thanks for your reply. would you please show it with code?
Thanks again
Dave Kreskowiak 25-May-13 15:53pm    
Nope. I don't have the time to write your code for you.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900