Q:

Why do I get `Procedure or function expects parameter`?

I'm inserting a row into a SQL Server 2005 database table from Classic ASP. 
I get the following error: 

Procedure or function 'replace_matl_form_insert' expects parameter '@matl_no',  which was not supplied.

I am supplying the parameter. The types match, and I'm still getting that error. Here is the classic asp code which is used to insert
     set CMDInsForm = Server.CreateObject("ADODB.Command")
     CMDInsForm.ActiveConnection = CONN
     CMDInsForm.CommandText = "dbo.replace_matl_form_insert"

     set parm = CMDInsForm.CreateParameter ("matl_no", adChar, adParamInput, 8, Trim(matl_no))
     CMDInsForm.Parameters.Append parm
     For each X in CMDInsForm.Parameters
          Response.Write err_msg & X.Name & ":" & X.Value & "<BR>"
     Next

     CMDInsForm.Execute

As you can see, I cycle through the parameters and print out their name and value. The name matl_no and the correct value are printed.
Here is the section of the stored procedure which retrieves it. 
ALTER PROCEDURE [dbo].[replace_matl_form_insert]
    (@matl_no char(8))
 AS [...]

I'm completely stumped. Does anybody have any suggestions on what it could be, or just take a shot in the dark? I don't care how crazy it sounds. 

A:

I think you need the "@" on the start of the parameter name:
set parm = CMDInsForm.CreateParameter ("@matl_no", adChar, adParamInput, 8, Trim(matl_no))

EDIT
Also, try setting the CommandType to 4 (which is adCmdStoredProc):
CMDInsForm.CommandType = 4

http://www.w3schools.com/ado/prop_comm_commandtype.asp

