ASP.NET 4.0 and the Entity Framework 4 - Part 3 - Execute Stored Procedures Using the Entity Framework 4
page 1 of 9
Published: 06 Apr 2010
Abstract
In this article, Vince demonstrates the usage of the Entity Framework 4 to execute stored procedures to create, read, update, and delete records in the database created in Part 1. After a short introduction, he examines the creation of the stored procedures and Web Forms, addition of the Stored Procedures to the Entity Model including adding, updating, and deleting records. He also shows how to retrieve a single record from the database.
by Vince Varallo
Feedback
Average Rating: This article has not yet been rated.
Views (Total / Last 10 Days): 37846/ 46

Introduction

This article will demonstrate how to use the Entity Framework 4 to execute stored procedures that create, read, update, and delete (CRUD) records from a SQL Server database.  This article builds upon the database that was generated in the first article, Create a Database Using Model First Development, and creates the same web page as in Part 2.  The web page functions the same except that it executes stored procedures rather than rely on the Entity Framework to create the dynamic SQL to access the database.   You'll need to download Visual Studio 2010 RC 1 from Microsoft's site in order for the sample code to work.  You can download the sample code and database script here (code) (script).

The goal of this article is to create a web page that allows a user to maintain the records in the UserAccounts table.  The final web page looks like the following image.

The drop down list at the top of the page allows you to navigate from user to user and display's the properties on the page.  The user can simply click the Save button to add or update records or click the Delete button to remove a record.


View Entire Article

User Comments

Title: Greate Writer   
Name: Alex
Date: 2012-09-04 11:54:02 AM
Comment:
Vince, is a great author. Looking forward from him a new book in asp.net 4.5 enterprise application development with all the latest features. EF, etc
Title: Stored Procedure doesn't return columns   
Name: Oscar
Date: 2011-12-28 10:18:54 AM
Comment:
I'm following your tutorial (very well done and thanks). When I reached the point to add the function import for the Select_all stored procedure I get the answer that the Stored Procedure doesn't return columns (My best translation from spanish). If I execute it from the sms client works fine.
Looked around alredy and didn't find anything. May be you could give a hint on where to look for a solution?
Title: Excellent   
Name: John
Date: 2011-05-05 4:00:03 PM
Comment:
excellent article
Title: Thanks a Ton!   
Name: Vipul
Date: 2011-03-22 12:02:05 AM
Comment:
Very helpful article indeed!
Title: Excellent   
Name: Sathiya
Date: 2011-01-09 6:04:12 AM
Comment:
Varallo,
Great Article and very impressive. Please post more article related to Framework 4.

Product Spotlight
Product Spotlight 





Community Advice: ASP | SQL | XML | Regular Expressions | Windows


©Copyright 1998-2024 ASPAlliance.com  |  Page Processed at 2024-04-20 4:42:52 AM  AspAlliance Recent Articles RSS Feed
About ASPAlliance | Newsgroups | Advertise | Authors | Email Lists | Feedback | Link To Us | Privacy | Search