Click here to Skip to main content
15,885,985 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I'm new in Entity Framework and i wanted to select all my rows from my model entity how can i select them and assign int to a DataSet? i want to show my data in data grid view

ProjectManagmentEntities pm = new ProjectManagmentEntities();

        public List<Project> SelectProjects()
        {
            List<Project> result = new List<Project>();
            foreach (Project item in pm.Projects)
            {
                result.Add(item);
            }
            return result;
        }



and in my form:
dataGridView1.DataSource = p.SelectProjects();
Posted
Comments
Simon_Whale 10-Dec-13 11:12am    
What is the problem? no results showing in the list? or the datagridview?

1 solution

You missed to bind data to the grid view.
dataGridview1.databind();
 
Share this answer
 

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