コード例 #1
0
 private void getTodoList()
 {
     using (TodoContext db = new TodoContext())
     {
         var TodoData = (from toDo in db.Todos
                         select toDo);
         ToDoGridView.DataSource = TodoData.ToList();
         ToDoGridView.DataBind();
     }
 }
コード例 #2
0
        protected void GetList()
        {
            using (TodoConnection db = new TodoConnection())
            {
                var todo = (from allItems in db.Todos
                            select allItems);


                //Bind the result
                ToDoGridView.DataSource = todo.ToList();
                ToDoGridView.DataBind();
            }
        }
コード例 #3
0
        /// <summary>
        /// This method gets the TodoList data from the DB
        /// </summary>
        private void GetTodoList()
        {
            // connect to EF DB
            using (TodoContext db = new TodoContext())
            {
                // query the TodoList Table using EF and LINQ
                var TodoData = (from allTodo in db.Todos
                                select allTodo);

                // bind the result to the TodoList GridView
                ToDoGridView.DataSource = TodoData.ToList();
                ToDoGridView.DataBind();
            }
        }