Click here to Skip to main content
15,881,649 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
Hi all.
I use Entity Framework for connect to my DB.
Im adding DataGridView on my form and creat that code:
C#
using (var db = new MyContext())
{
    try
    {
        BindingSource bs = new BindingSource();
        db.SCADA.Select(v => v).Load();
        bs.DataSource = db.SCADA.Local.ToBindingList();
        dataGridView1.DataSource = bs;
    }
}

and my DataGridView show me result, all great.
How can i do Insert, Update and Delete items, form DataGridView?
I want do like there:
Entity Framework in WinForms[^]
but i cant, coz i use deferent version EntityFramework(6.0)

What I have tried:

Do only select data from database(context).
Posted
Comments
johannesnestler 17-Mar-16 11:13am    
better read any tutorial on this with a step by step instruction, such answeres are hard to give because we don't know what you know. There are so many tutorials for basic CRUD with EF out there, find one for your version of EF (what's wrong with the article you linked? I found this link there (but didn't look at the code): http://www.codeproject.com/KB/database/EFWinForms/EF6Winforms.zip

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