asp中存储过程输出参数问题

来源:百度知道 编辑:UC知道 时间:2024/05/28 23:24:09
怎么在ASP中取得存储过程的输出参数?给个详细的例子!还有在给参数赋值的时候如Set Ename_param = cmd.CreateParameter("@zhang",adVarChar,adParamOutput,50)这个@zhang是不是必须与定义存储过程中的那个参数名字一样?还是其他名字都可以,只要顺序对应到就行?大家帮帮忙!
那那个参数名可以变吗?
我的意思就是说存储过程里面是aaaa那么外边加参数的时候名称就一定要是aaaa?还是他的名字可以变,他是通过参数加入的顺序来确定他是传给哪个参数的?

给段代码你参考:
dim execon
set execon = server.CreateObject("adodb.command")
set execon.activeconnection=conn
execon.CommandType=adCmdStoredProc
execon.CommandText="dt_EnterprisePhoneBookAdd"

.Parameters.Append execon.CreateParameter("@OwnerId",adInteger,adParamInput,,session("userid"))
execon.Parameters.Append execon.CreateParameter("@Name",adVarChar,adParamInput,100,trim(zname))
execon.Parameters.Append execon.CreateParameter("@ContactId",adInteger,adParamOutput)
contactid=execon.Parameters("@ContactId").Value'获取存储过程返回值.

=================================================
补充:
当然可以改的,我这里只是一个示例,你要根据你的存储过程来写,参数名称根据你存储过程里的OutPut参数名称来写.