---
title: "Call stored procedures with Entity Framework 6 data first approach in Asp.Net MVC 4"  
description: "Call stored procedures with Entity Framework 6 data first approach in Asp.Net MVC 4"  
author: "Manish Kumar"  
published: 2018-05-24  
updated: 2018-05-24  
canonical: https://www.mindstick.com/forum/34493/call-stored-procedures-with-entity-framework-6-data-first-approach-in-asp-dot-net-mvc-4  
category: "asp.net"  
tags: ["asp.net", "asp.net mvc"]  
reading_time: 2 minutes  

---

# Call stored procedures with Entity Framework 6 data first approach in Asp.Net MVC 4

I am using [mvc](https://www.mindstick.com/forum/155803/define-cache-profile-in-mvc) framerwork 4.5 with [entityframework](https://www.mindstick.com/forum/161466/what-is-the-working-process-of-entityframework) 6.0 .Can [someone tell me](https://www.mindstick.com/forum/34097/can-someone-tell-me-what-is-the-most-effective-optimization-on-page-optimization-or-off-page-optimization) how to call [store procedure](https://www.mindstick.com/forum/193/auto-increment-by-store-procedure) with [parameter](https://www.mindstick.com/blog/450/parameter-class-in-c-sharp)

\

## Replies

### Reply by Anonymous User

I telling you how to get record using [store](https://www.mindstick.com/articles/13125/tips-to-increase-sales-of-your-woocommerce-store) [procedure](https://www.mindstick.com/forum/32/stored-procedure-return-datatype)

```
 using (var db = new MindStickDBEntities())
                    {
                        var cmd = db.Database.Connection.CreateCommand();
                        cmd.CommandText = "[dbo].[Sp_Getrecord]";
                        cmd.CommandType = CommandType.StoredProcedure;
                        cmd.Parameters.Add(new SqlParameter("@pageNo", pageNo));
                        cmd.Parameters.Add(new SqlParameter("@pageSize", pageSize));

                        try
                        {
                            db.Database.Connection.Open();
                            using (var result = cmd.ExecuteReader())
                            {
                                var recordlist= ((IObjectContextAdapter)db).ObjectContext.Translate<PostModel>(result).ToList();
                                result.NextResult();

                            }

                        }
```

hope it helps you..


---

Original Source: https://www.mindstick.com/forum/34493/call-stored-procedures-with-entity-framework-6-data-first-approach-in-asp-dot-net-mvc-4

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
