Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7129843
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T11:17:10+00:00 2026-05-28T11:17:10+00:00

(Using MVC4 VB EF4 MSSQL Razor) I created a Stored Procedure in the MS

  • 0

(Using MVC4 VB EF4 MSSQL Razor)

I created a Stored Procedure in the MS SQL 2008 database. Then I’ve added that SP into the Entity Framework model (you do not see it after opening the .edmx file, i see the SP when i open the model browser). Next i did an “Add function import…” . I did [Get Column Information] and “Create new complex type”.

So now I’d like to use that SP. And using ExecuteStoreQuery seems the way to go.

The best attempt so far is this:

Function Index() As ViewResult
 Dim context As New MyEntities
 Dim Result
 ' Call the SP with parameter "A"
 Result = context.ExecuteStoreQuery(Of MySP_Result)("MySP @p0", "A").ToList
 Return View(Result)
End Function

Where “MySP_result” is the name of the Complex Type that is returned by the SP (i see it in the EF model browser). After pressing F5 i get:

The model item passed into the dictionary is of type
System.Collections.Generic.List,
but this dictionary requires a model item of type
System.Collections.Generic.IEnumerable

So what do i have to change?

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T11:17:11+00:00Added an answer on May 28, 2026 at 11:17 am

    A standard genereated list view starts with:

    @ModelType Mvc4App2.[classname]
    

    It took me a while to understand the error message correctly. you need to change that line into:

    @ModelType IEnumerable(Of Mvc4App2.[name of the complex type])
    

    I also changed the controller code a little:

    Dim context As New [Name of the EF model]
    Dim Result As List(Of [name of the complex type])
    Result = context.ExecuteStoreQuery(Of [name of complex type])_
                   ("[name of the stored procedure @p0", "[parameter 0]").ToList
    Return View(Result)       
    End Function       
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I've got really used to developing views in MVC4 using Razor. But I have
Using the following as an example (with $db being a previously created database connection
Using Entity Framework CodeFirst, how do I create a created datetime column that gets
Using ASP.NET MVC there are situations (such as form submission) that may require a
Using TortoiseSVN against VisualSVN I delete a source file that I should not have
Using C#, I need a class called User that has a username, password, active
(im using MVC4 VB). I want a FOR .. NEXT loop in my T4
I am in a process of upgrading a c# MVC2 project into c# MVC4.
I am using the new mvc4 ajax controller template and I don't know how
I'm using ASP.NET MVC4 (EF Code-first) with WCF ADO.NET Data Service October 2011 CTP.

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.