Question: I am working on a PHP page where I need a date picker. So I added the following files:

```
<script src="../J/jquery.js"></script>
<script src="../J/jquery.min.js"></script>
<script src="../J/jquery-1.5.2.min.js"></script>
<script src="../J/jquery.ui.core.js"></script>
<script src="../J/jquery.ui.datepicker.js"></script>

```

Here's the relevant JS:

```
$(function() {
   $( "#Date" ).datepicker({ dateFormat: 'dd-M-yy',
      showOn: "button",
      buttonImage: "../I/dateimg.png",
      minDate:'<?php echo $minDate; ?>',
      maxDate:'<?php echo $maxDate; ?>',
      buttonImageOnly: true,
      firstDay:1,
      beforeShowDay: checkDisabled,
      changeMonth: true,
      changeYear: true,
      beforeShow: function(input, inst){
         inst.dpDiv.css({marginTop: -input.offsetHeight + 'px', marginLeft:`input.offsetWidth-210 + 'px'});
      } 

   });
});

```

And here's the tag I'm using:

```
<input type="text" class="form-control" id="Event_Date"  value="<?php echo $Todaysdate ?>" />

```

But still i am getting this below error

> 
> TypeError: $(...).datepicker is not a function
> 
> 
> 

Any help is appreciated.

Answer: 
The error message is quite clear. The number of input parameters which you are passing from the front end is greater than the expected number of parameters in your stored procedure.

Your stored procedure expects only these input parameters:

```
@Score INT=0,
@CorrectAnswer INT=0,
@WrongAnswer INT=0,
@TimeSpent INT=0,
@QuizId INT=0,
@UserId INT=0,
@UserName NVARCHAR(200)="No User",
@GroupId INT=0,
@GroupName NVARCHAR(200)="NoGroup"

```

For example you are passing:

```
dbCon.AddParameter("@SessionId", sid);

```

from front end and there is no parameter defined as @SessionId in your procedure.

**Solution:**

From the solution point of you, you need to alter your stored procedure and add the missing parameters which you are passing in your procedure. Something like this:

```
ALTER PROCEDURE [dbo].[spUpdateQuizScore]
 -- Add the parameters for the stored procedure here
@Score INT=0,
@CorrectAnswer INT=0,
@WrongAnswer INT=0,
@TimeSpent INT=0,
@QuizId INT=0,
@UserId INT=0,
@UserName NVARCHAR(200)="No User",
@GroupId INT=0,
@GroupName NVARCHAR(200)="NoGroup",
@SessionId INT=0

```
Update your stored procedure.You missed on the SessionId here 

```
ALTER PROCEDURE [dbo].[spUpdateQuizScore]
 -- Add the parameters for the stored procedure here
@Score INT=0,
@CorrectAnswer INT=0,
@WrongAnswer INT=0,
@TimeSpent INT=0,
@QuizId INT=0,
@UserId INT=0,
@UserName NVARCHAR(200)="No User",
@GroupId INT=0,
@GroupName NVARCHAR(200)="NoGroup",
@SessionId int
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;

-- Insert statements for procedure here
INSERT INTO QuizScores(Score,CorrectAnswers,WrongAnswers,TimeSpent,QuizId,UserId,UserName,GroupId,GroupName,SessionId) VALUES(@Score,@CorrectAnswer,@WrongAnswer,@TimeSpent,@QuizId,@UserId,@UserName,@GroupId,@GroupName,@SessionId)
END

```