Get data From Database table using EDMX in ASP.NET

In this article, I will show you, how to get data from Database table using EDMX file. Actually EDMX reduces lots of codes, you can see this article which contains lots of codes. EDMX file provides model as well as context class. By using public property of context class, we can communicate with the table.  Before copy this code, first to add EDMX file in solution.

Get data From Database table using EDMX in ASP.NET

Source code

   <form id="form1" runat="server">  
     <asp:GridView ID="GridView1" runat="server">  

Code Behind 

   private void loadgrid()  
     //throw new NotImplementedException();  
     dbEntities dbe = new dbEntities();  
     var item = dbe.usertables.ToList();  
     GridView1.DataSource = item;  


Popular posts from this blog

difference between structure and union in C Language

Difference between Linear search and Binary Search in c language

Difference between static and dynamic websites