Loading Data from Multiple Tables into Data Grid using Entity Framework

To load data from multiple SQL tables into a C# data grid view you must first create a view in SQL which you will then add to your model. Once created, using entity framework in Visual Studio’s IDE you can call the data-set to load data into your data grid view.

Step 1 : In Microsoft SQL Server Management Studio Object Explorer right click on your view folder and select new view. Add the tables you want to pull data from and save the view in SQL.

 

 

Step 2 : In Visual Studio IDE go to your Model.edmx and right click then select update model from database. Select the view from the update wizard and click finish.

 

 

Step 3 : From Visual Studio IDE select a datagrid component, add it to your form then on the top right corner click on select datasource. Find the Datasource , select it and it will be loaded on the data grid component on your form.

create new view in sql
Right Click on Views Folder Icon and select new view
Visual Studio 2015 Update Wizard
Insert SQL View into Model in Visual Studio IDE
Select View as DataSource
Step 3 : Select Data source

Leave a Reply



How to code your own sFTP File Uploader Windows application using C# and SSH

Total Page Visits: 1616 – Today Page Visits: 1

ArcMap 10.4 – Using python function in field calculator to update date values from another column

Total Page Visits: 1616 – Today Page Visits: 1

XLS to DBF File Conversion using ExcelDataReader

Total Page Visits: 1616 – Today Page Visits: 1

Total Page Visits: 1616 - Today Page Visits: 1