This article explains how to
create an edmx file, write the Lambda Expression and the last one is
CRUD (Insert, Update, Delete and Select).
First of all create a database (I am using the Northwind database.).
Step 1:
Create a new Windows Form Application project:
Step 2:
"EntityFrameWorkSample" >> "Add" >> "New Item" >> "Data" >> "ADO.NET
Entity Data Model"
On the other hand write your model
name (Model1.edmx is the default name; I do not want to change it) and push the "Add"
button.
Step 3:
Choose the model content. I used "Generate
from database".
Step 4:
There is the Entity Connection. If you want to
change this connection string open the App.config file.
If you have no connection then you must create a new connection from the "New
Connection" button and choose your database.
Choose Your Server Name and "Log on to the server"
(this is the security level) and finally select your database. I used the
Northwind database. Click the "Ok" button.
Step 5:
Choose the Categories table and select this
one. Click the "Finish" button.
Step 6:
The model will be generated and opened in the
EDM Designer.
How to display data on the DataGridView?
How to insert data from the Categories table?
I changed the button name from Designer
(btnInsert) and changed the Textbox name (tbCategoryName, DescriptionName). If I
insert new data, I should use the Add method.
How to use SelectionChangeCommitted Event?
How to delete your data from the Categories table?
How to update your data from the Categories table?