
May 20th, 2003, 05:33 PM
|
|
Junior Member
|
|
Join Date: Jan 2003
Posts: 29
Time spent in forums: < 1 sec
Reputation Power: 0
|
|
|
Calling SQL Server SP From ASP
Here's my neat, clean call to a SQL Server stored procedure:
Code:
<%
Set Cmd = Server.CreateObject("ADODB.Command")
With Cmd
.ActiveConnection = "Provider=sqloledb;" & _
"Data Source=99.99.999.999;" & _
"Initial Catalog=xxx;" & _
"User ID=xxx;" & _
"Password=xxxx"
.CommandText = "Get_Customer" ' name of stored procedure
.CommandType = adCmdStoredProc ' 4
.Parameters.Append .CreateParameter _
("@PIN", adVarWChar, adParamInput, 13, "111 111-1234")
.Parameters.Append .CreateParameter _
("@ErrorCode", adVarWChar, adParamReturnValue, 15)
Set Rs_Customer = Server.CreateObject("ADODB.Recordset")
On Error Resume Next
Set Rs_Customer = .Execute
%>
Unfortunately, when the command object arrives at SQL Server, it seems to say "Exec Get_Customer;1"
There's no sign of the input parameter value, and we can't figure out where the ";1" is coming from.
With the second parameter commented out, this routine works perfectly calling an MS Access stored procedure. But something seems to be keeping the input parameter from being passed properly to SQL Server.
Any ideas?
|