Problem calling SQL Server stored procedure from classic ASP
Posted on 2007-10-02
Hi, I'm trying to call a SQL Server 2005 stored procedure from a classic ASP page using ADO. I have verified that the connection string is correct, the user login has permissions to execute the procedure in question, and that the procedure itself functions properly. I can reproduce the results in the ASP page by passing in hard-coded SQL. However, when I call .Execute, I get this error:
Microsoft OLE DB Provider for SQL Server error '80040e14'
Syntax error or access violation
The relevant code snippet is below:
Dim Cmd : Set Cmd = Server.CreateObject("ADODB.Command")
.ActiveConnection = Cn
.CommandType = adCmdStoredProc
.CommandText = "getNAIC-ID"
.Parameters.Append .CreateParameter("@naic_code", adVarChar, adParamInput, 15, Session("SalesImaging_CompanyNum"))
.Parameters.Append .CreateParameter("@naic_id", adInteger, adParamOutput, ,0)
root = .Parameters("@naic_id")
Sorry if I'm missing the obvious - thanks!