I am getting the following error when I try to execute an sql server stored procedure
Error
An error occurred during the compilation of a resource required to process this request. Please review the following specific error details and modify your source code appropriately.
C:\\inetpub\\wwwroot\\staging_publishing\\zia_ReconIQ\\Views\\Home\\ExecuteBankReconMatchingsp.cshtml
* ### The name 'EntityID' does not exist in the current context
* ### The name 'GLAccount' does not exist in the current context
* ### The name 'ReconYear' does not exist in the current context
* ### The name 'ReconMonth' does not exist in the current context
Below is my step by step process
Custom View Tag from generated table
<a href="ExecuteBankReconMatchingsp?entityId=@UrlEncode(CurrentPage.EntityID?.CurrentValue ?? "")&postingMonth=@UrlEncode(CurrentPage.ReconMonth?.CurrentValue ?? "")&postingYear=@UrlEncode(CurrentPage.ReconYear?.CurrentValue ?? "")&glAccountNumber=@UrlEncode(CurrentPage.GLAccount?.CurrentValue ?? "")">
Execute Matching
Content of Custom File : ExecuteBankReconMatchingsp
using Microsoft.AspNetCore.Mvc;
using Microsoft.AspNetCore.Mvc.RazorPages;
using System.Data;
using System.Data.SqlClient;
public class ExecuteBankReconMatchingspModel : PageModel
{
private readonly IConfiguration _config;
public ExecuteBankReconMatchingspModel(IConfiguration config)
{
_config = config;
}
[BindProperty(SupportsGet = true)]
public string EntityID { get; set; }
[BindProperty(SupportsGet = true)]
public string GLAccount { get; set; }
[BindProperty(SupportsGet = true)]
public int ReconYear { get; set; }
[BindProperty(SupportsGet = true)]
public int ReconMonth { get; set; }
public async Task<IActionResult> OnGetAsync()
{
var result = new Dictionary<string, string>();
using var conn = new SqlConnection(_config.GetConnectionString("DefaultConnection"));
using var cmd = new SqlCommand("SP_MLCockpitStaging", conn)
{
CommandType = CommandType.StoredProcedure
};
cmd.Parameters.AddWithValue("@EntityID", EntityID);
cmd.Parameters.AddWithValue("@GLAccount", GLAccount);
cmd.Parameters.AddWithValue("@ReconYear", ReconYear);
cmd.Parameters.AddWithValue("@ReconMonth", ReconMonth);
await conn.OpenAsync();
using var reader = await cmd.ExecuteReaderAsync();
if (await reader.ReadAsync())
{
result["entityId"] = reader["EntityID"]?.ToString() ?? "";
result["postingMonth"] = reader["PostingMonth"]?.ToString() ?? "";
result["postingYear"] = reader["PostingYear"]?.ToString() ?? "";
result["glAccountNumber"] = reader["GLAccountNumber"]?.ToString() ?? "";
result["totalRecords"] = reader["TotalRecordsProcessed"]?.ToString() ?? "";
result["matched"] = reader["MatchedRecords"]?.ToString() ?? "";
result["unmatchedBank"] = reader["UnmatchedBankRecords"]?.ToString() ?? "";
result["unmatchedLedger"] = reader["UnmatchedLedgerRecords"]?.ToString() ?? "";
result["processingTime"] = reader["ProcessingTime"]?.ToString() ?? "";
result["runTimestamp"] = reader["RunTimestamp"]?.ToString() ?? "";
}
return RedirectToPage("matchingenginesuccess", result);
}
}
Would really appreciate a non expert level guidance as I am not a developer. I am a business analyst using ASP.NET Maker for our business needs