How to: Execute a Parameterized Stored Procedure Using EntityCommand
This topic shows how to execute a parameterized stored procedure by using the EntityCommand class.
In the code page for your application, add the following
Importsin Visual Basic):
[!CODE [DP EntityServices Concepts#Namespaces](../CodeSnippet/VS_Snippets_Data/dp entityservices concepts#namespaces)]
GetStudentGradesstored procedure and specify
CourseGradeentities as a return type. For information on how to import a stored procedure, see How to: Import a Stored Procedure.
The following code executes the
GetStudentGrades stored procedure where
StudentId is a required parameter. The results are then read by an EntityDataReader.
[!CODE [DP EntityServices Concepts#StoredProcWithEntityCommand](../CodeSnippet/VS_Snippets_Data/dp entityservices concepts#storedprocwithentitycommand)]