日期:2014-05-16  浏览次数:20879 次

asp+存储过程,死活调不出参数。
本帖最后由 hgwyl 于 2013-04-03 15:08:34 编辑
1.asp页面代码如下

<!--#include file="rth_conn/rth_conn.asp"-->
<%
Set Cmd = Server.CreateObject("ADODB.Command")
Set Cmd.ActiveConnection=conn
Cmd.CommandText="test"
Cmd.CommandType=4
CMD.Prepared = true
Cmd.Parameters.Append cmd.CreateParameter("@sex",200,2,10)
Cmd.Execute
sex=Cmd(1)
set Cmd = nothing
%>
<table width=200>
<tr><td><%=sex%></td></tr>
<tr><td><a href=1.asp>刷新本页</a></td></tr>
<tr><td><a href=index.asp>返回首页</a></td></tr>
</table>
<%
conn.close
set conn=nothing
%>


存储过程如下
USE [数据库名]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[text]
@sex nvarchar(10) output
AS
BEGIN
SET @sex='男'  --这里用select也不对
END
GO  --这里去掉GO也不对

------解决方案--------------------
可以使用{call storedprocedure的名字}来做的。