0

I am trying to use this stored procedure below to create a list which I can then export as an Excel file. I have been using Entity Framework thus far, but I am unsure how to go about this in my controller:

CREATE PROCEDURE [dbo].[spFlugReport]     
(      
   @AccNo INTEGER,
   @DateFrom DATE, 
   @DateTo DATE    
)      
AS
BEGIN
    SELECT * 
    FROM [dbo].[KIRData] 
    WHERE AccNo = @AccNo 
      AND StartDate >= @DateFrom 
      AND EndDate <= @DateTo 
      AND Prod = 'Air'
END
marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
sun22
  • 29
  • 1
  • 6

1 Answers1

0

That sounds like a combination of 2 questions:

  1. How to call a stored procedure, and
  2. How to create an Excel document

For calling a stored procedure, there is a good thread here that should be useful to you, it explains how to use Entity to call a stored procedure How to call Stored Procedure in Entity Framework 6 (Code-First)?

Second, to create an Excel document I'd suggest you have a look at ClosedXML, it's pretty straight forward to use and has proven reliable at producing Excel docs https://github.com/closedxml/closedxml and https://www.nuget.org/packages/ClosedXML

Hope that helps.

marc_s
  • 732,580
  • 175
  • 1,330
  • 1,459
Stevie W
  • 412
  • 7
  • 16