I currently have an ASP.NET MVC application trying to execute a stored procedure.
My stored procedure is like this:
ALTER PROCEDURE [dbo].[_SelectFromQry]
@queryname NVARCHAR(255)
AS
BEGIN
SELECT TBLNAME, TBLCOL, TBLCOLLABEL, POSITION
FROM QRY
WHERE QUERYNAME = @queryname
END
Inside my controller, I have written a code like this:
var result = db.Database.SqlQuery<RESULT_FROM_QRY>("_SelectFromQry", new SqlParameter("queryname","INVAVAIL")).ToList();
When the application reaches this line, I get a
SqlCilent.SqlExcepction: procedure '_SelectFromQry' expects parameter '@queryname' which was not supplied.
I am not sure if I am calling the stored procedure correctly with my code?