Search code examples
asp.net-mvcpetapoco

Display value in Database DataContext


This is my Query =>

var department = dataContext.Query<Department>("SELECT Id FROM tblDepartment");

I want to display the values in variable Department in ViewBag or Anywhere.How can I do that?


Solution

  • var department = dataContext.Query<Department>("SELECT Id FROM tblDepartment").ToList() 
    

    and then work with list