title: What's wrong in Classic ASP StoredProcedure insert statement
body: <p>Here is the classic ASP code</p>
  
  <pre><code>Set objCommandSec = CreateObject("ADODB.Command")
          With objCommandSec
              Set .ActiveConnection = MyConn
              .CommandType = adCmdStoredProc
              .CommandText = "ReportsPDFInsert"
  
              .CreateParameter "@StatsID", adInteger, adParamInput
              .Parameters("@StatsID") = xStats_ID
  
              .CreateParameter "@MemberID", adInteger, adParamInput
              .Parameters("@MemberID") = xMemberID
  
              .CreateParameter "@LanguageID", adInteger, adParamInput
              .Parameters("@LanguageID") = 1  '1=EN
  
              .CreateParameter "@PDFFilename", adVarWChar , adParamInput
              .Parameters("@PDFFilename") = PDFFilename
  
              .Execute
          End With 
  </code></pre>
  
  <p>Here is the stored procedure code</p>
  
  <pre><code>ALTER PROCEDURE [dbo].[ReportsPDFInsert]
  -- Add the parameters for the stored procedure here
  @StatsID INT
  ,@MemberID INT
  ,@LanguageID     INT
  ,@PDFFilename NVARCHAR(50)
  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 [dbo].[ReportsPDF]
         ([StatsID]
         ,MemberID
         ,[LanguageID]
         ,[PDFFilename]
         ,[DateCreated])
   VALUES
         (@StatsID
         ,@MemberID
         ,@LanguageID
         ,@PDFFilename
         ,GETDATE())
  
  END
  </code></pre>
  
  <p>I get error as</p>
  
  <p>Error number: -2147217904</p>
  
  <p>Error description: Procedure 'ReportsPDFInsert' expects parameter '@StatsID', which was not supplied.</p>
  
  <p>Source: Microsoft OLE DB Provider for SQL Server</p>
  
  <p>If I execute the stored procedure itself, then it is working fine.  I have similar classic asp code in other page, and that works fine as well.  yes, I made sure xStats_ID does have value.  I printed just before the .Execute and I see the value.</p>
  
  <p>Please somebody shed some light.  Thanks</p>