tag:blogger.com,1999:blog-6082652835152798567.post5781510097894241797..comments2024-03-28T21:41:58.974-07:00Comments on Sql server, .net and c# video tutorial: Part 23 - Many to many relationship in entity framework code firstUnknownnoreply@blogger.comBlogger3125tag:blogger.com,1999:blog-6082652835152798567.post-52296164925968440142022-04-11T07:06:31.755-07:002022-04-11T07:06:31.755-07:00try below
GridView1.DataSource = (from student in...try below<br /><br />GridView1.DataSource = (from student in employeeDBContext.Students.Include("Courses")<br />from c in student.Courses<br />select new<br />{<br />StudentName = student.StudentName,<br />CourseName = c.CourseName<br />}).ToList();ghosthttps://www.blogger.com/profile/02938547435717509786noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-77150219503273590162021-01-26T08:01:24.717-08:002021-01-26T08:01:24.717-08:00Getting a null ref error initially from :
GridV...Getting a null ref error initially from :<br /><br /> GridView1.DataSource = (from student in employeeDBContext.Students<br /> from c in student.Courses<br /> select new<br /> {<br /> StudentName = student.StudentName,<br /> CourseName = c.CourseName<br /> }).ToList();<br /><br />Please let me know how it could be solved?? and also why wasnt this error in the video..as it is a valid scenario I believeShubhamhttps://www.blogger.com/profile/06771413114581532514noreply@blogger.comtag:blogger.com,1999:blog-6082652835152798567.post-90173164294564317292017-03-10T14:21:43.567-08:002017-03-10T14:21:43.567-08:00Include is referred only code first approach. ...Include is referred only code first approach. May know why it is not required in other approach (ie Part 22)<br /><br />employeeDBContext.Students.Include("Courses")Anonymousnoreply@blogger.com