ALTER PROCEDURE [dbo].[SelectCompletionNonCompletionCourseReport]
@LearnerName NVARCHAR(510) = NULL,
@ManagerId INT = NULL,
@CourseId INT = NULL,
@StartDateFrom SMALLDATETIME = NULL,
@StartDateTo SMALLDATETIME = NULL,
@TeamList XML = NULL,
@JobID NVARCHAR(max)=NULL,
@CourseStatus NVARCHAR(20)=NULL,
@ReportAdminID INT=0,
@ReportTeamList NVARCHAR(max)=NULL,
@RowsTotal int = 0,
@PageIndex int = 1,
@RowsPerPage int = 10
AS
BEGIN
DECLARE @TblCrieiria TABLE
(
id INT IDENTITY(1, 1),
areacode NVARCHAR(11),
regioncode NVARCHAR(11),
teamcode NVARCHAR(11)
)
IF @TeamList IS NULL
BEGIN
INSERT INTO @TblCrieiria VALUES(NULL,NULL,NULL)
END
BEGIN
This is the beginning of the procedure...
using (Database db = new Database(DScape.DAL.Config.ConfignPropertyName.DSCAPELMS_CONNECTION_STRING_NAME))
{
var cmd = new SqlCommand
{
CommandText = "SelectCompletionNonCompletionCourseReport",
CommandType = CommandType.StoredProcedure
};
cmd.Parameters.AddWithValue("@LearnerName", LearnerName);
cmd.Parameters.AddWithValue("@ManagerId", ManagerId);
cmd.Parameters.AddWithValue("@CourseId", CourseId);
cmd.Parameters.AddWithValue("@StartDateFrom", StartDateFrom);
cmd.Parameters.AddWithValue("@StartDateTo", StartDateTo);
cmd.Parameters.AddWithValue("@TeamList", TeamList);
cmd.Parameters.AddWithValue("@JobID", JobID);
cmd.Parameters.AddWithValue("@CourseStatus", CourseStatus);
cmd.Parameters.AddWithValue("@ReportAdminID", ReportAdminID);
cmd.Parameters.AddWithValue("@ReportTeamList", ReportTeamList);
cmd.Parameters.AddWithValue("@PageIndex", 1);
DataSet dsClient = db.GetDataSet(cmd);
if (dsClient.Tables.Count > 0)
return dsClient.Tables[0];
else
return null;
}
This is the method which communicates with the procedure, and it gaves me an error
Parameter does not exist as a stored procedure parameter/ function/procedure take too many arguments...
It's about @PageIndex
parameter. Doesn't matter what is the value, we don't talk for values here but for parameter which is defined in the stored procedure but doesn't work?
And for the record, this problem did pop-up today w/o any code writing/modifying just appeared as I tried to do that report, when yesterday it was all good...I have a teammate which is next to me with absolute the same code both in sql and c# and it works just fine on his pc, but mine throws this errors, I'm trying to resolve this from 3 hours and I am completely out of answers , so please give me direction in which should I continue to resolve this .....................
and I say again, the problem is not from the connection to DB or type of the parameter or the value, the error is committed with the parameter itself - does not exist in the procedure, which is insane in my opinion.