From the following code I get the error that @StartDate
is not supplied, however stepping through the two date range parameters have a valid value:
SqlParameter[] ps = new SqlParameter[]
{
new SqlParameter("@StartDate", startDate),
new SqlParameter("@EndDate", endDate)
};
List<AttendanceReportViewModel> res = db.Database.SqlQuery<AttendanceReportViewModel>(Local.queries["AttendanceReport"], ps).ToList();
return res;
The stored procedure :
ALTER PROCEDURE [dbo].[GetAttendanceReport]
@StartDate datetime,
@EndDate datetime
AS
BEGIN
SET NOCOUNT ON;
exec [REMOTE_SRV].LWD.dbo.ReportAttendance_sp @StartDate = @StartDate, @EndDate = @EndDate;
END
Everything works fine when I execute the stored procedure in SQL Server Management Studio but doesn't from within the application.