0

I have created a dynamic stored procedure (using Pivot). I have no idea about the columns returned by the stored procedure. So I am not able to create a viewmodel class.

I searched and found this method to execute stored procedure:

public List<dynamic> GetData(int CurriculumID)
{  
    var data = context.Database.SqlQuery<dynamic>("MyProcedureName @CurriculumId", new SqlParameter("CurriculumId", CurriculumID)).ToList();
    return data;
 }

Now I am not sure how to send this data to razor view and create dynamic table based on the data. Any guidance?

I am also not able to view data here is how I am getting it:

enter image description here

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Tony S
  • 156
  • 1
  • 2
  • 15
  • I don't know what `MyProcedureName` returns, can you provide table structure behind it? Since return type is `List`, read this first: https://stackoverflow.com/questions/23670408/how-to-fetch-data-from-listdynamic. – Tetsuya Yamamoto Nov 17 '17 at 09:21
  • Possible duplicate of [Dynamic Object Intellisense](https://stackoverflow.com/questions/11289995/dynamic-object-intellisense) – Tetsuya Yamamoto Nov 17 '17 at 09:25
  • MyProcedureName is returning n number of columns.. Sometimes only 2 columns sometimes 50 columns – Tony S Nov 17 '17 at 09:29

0 Answers0