Wrox Home  
Search P2P Archive for: Go

  Return to Index  

asp_databases thread: Problem displaying output parameter


Message #1 by "Abraham" <asryf@y...> on Tue, 7 Jan 2003 01:47:17
Hi

Would somebody tell me why in the example below everything is fine just 
the output parameter doesen't display. Here is the code:


<%
set con = server.createobject("ADODB.Connection")
con.Open "Keystone_DSN", "Abraham", "abraham"
set objcomd = server.createobject("ADODB.Command")
set objcomd.ActiveConnection = con
objcomd.CommandText = "GetCustomerPhone"	
objcomd.CommandType = 4
	
objcomd.Parameters("@customerID") = 90
objcomd.Parameters("@Phone") = Null
set objrst = objcomd.Execute
%>


<html>
<body>
First: <%=objrst("First")%><br>
Last: <%=objrst("Last")%><br>
Phone: <%=objrst("Phone")%><hr>
Phone: <%=objcomd.parameters("@Phone")%>
</body>
</html>

Here is the Stored Procedure:

CREATE PROCEDURE GetcustomerPhone(@CustomerID int, @Phone varchar(30) 
output) AS

Select  *  from customer where CustomerID=@CustomerID

Select @Phone =  Phone from customer where CustomerID = @CustomerID

Return

Thanks

Abraham
Message #2 by "Ken Schaefer" <ken@a...> on Tue, 7 Jan 2003 12:54:47 +1100
http://www.adopenstatic.com/faq/SprocsAndParameters.asp

Cheers
Ken

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
From: "Abraham" <asryf@y...>
Subject: [asp_databases] Problem displaying output parameter


: Would somebody tell me why in the example below everything is fine just 
: the output parameter doesen't display. Here is the code:
: 
: <%
: set con = server.createobject("ADODB.Connection")
: con.Open "Keystone_DSN", "Abraham", "abraham"
: set objcomd = server.createobject("ADODB.Command")
: set objcomd.ActiveConnection = con
: objcomd.CommandText = "GetCustomerPhone" 
: objcomd.CommandType = 4
: 
: objcomd.Parameters("@customerID") = 90
: objcomd.Parameters("@Phone") = Null
: set objrst = objcomd.Execute
: %>
: 
: 
: <html>
: <body>
: First: <%=objrst("First")%><br>
: Last: <%=objrst("Last")%><br>
: Phone: <%=objrst("Phone")%><hr>
: Phone: <%=objcomd.parameters("@Phone")%>
: </body>
: </html>
: 
: Here is the Stored Procedure:
: 
: CREATE PROCEDURE GetcustomerPhone(@CustomerID int, @Phone varchar(30) 
: output) AS
: 
: Select  *  from customer where CustomerID=@CustomerID
: 
: Select @Phone =  Phone from customer where CustomerID = @CustomerID
: 
: Return

~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~

  Return to Index