为何写的代码读取不了返回值
Const adInteger= 3
Const adVarChar= 200
Const adParamInput= 1
Const adParamOutput= 2
Const adCmdSPStoredProc = 4
Const adParamInputOutput= 3
dim searchText
searchText = trim(request.Form( "SearchText "))
TableName = "information "
Fields = "title,test_classid,info_classId "
OrderField = "title,id "
sqlWhere = "title like '% "&ReplaceDot(searchText)& "% ' "
pageSize = 12
pageIndex = 1
TotalPage = 0
set commProc=server.createobject( "adodb.command ")
commProc.commandtext= "CommonPageProc "
commProc.CommandType = adCmdSPStoredProc
set commProc.ActiveConnection=conn
commProc.Parameters.append commProc.CreateParameter( "@TableName ",adVarChar,adParamInput,50,TableName)
commProc.Parameters.append commProc.CreateParameter( "@Fields ",adVarChar,adParamInput,5000,Fields)
commProc.Parameters.append commProc.CreateParameter( "@OrderField ",adVarChar,adParamInput,5000,OrderField)
commProc.Parameters.append commProc.CreateParameter( "@sqlWhere ",adVarChar,adParamInput,5000,sqlWhere)
commProc.Parameters.append commProc.CreateParameter( "@pageSize ",adInteger,adParamInput,,pageSize)
commProc.Parameters.append commProc.CreateParameter( "@pageIndex ",adInteger,adParamInput,,pageIndex)
commProc.Parameters.append commProc.CreateParameter( "@TotalPage ",adInteger,adParamOutput,,TotalPage)
Set rsProc = commProc.Execute()
response.Write(rsProc.recordcount & ": " & commProc.Parameters( "@TotalPage ").Value)
do while not rsProc.EOF
response.Write(rsProc( "title ")& " <br/> ")
rsProc.MoveNext()
loop
------解决方案--------------------Set rsProc = commProc.Execute()
rsProc.close '带返回记录集和返回参数的存储过程,必须先将记录集关闭,再获取返回参数
response.Write(rsProc.recordcount & ": " & commProc.Parameters( "@TotalPage ").Value)
rsProc.open '记录集需要用时,再次打开
do while not rsProc.EOF
response.Write(rsProc( "title ")& " <br/> ")
rsProc.MoveNext()
loop
------解决方案--------------------参考
http://blog.csdn.net/xuStanly/archive/2006/09/27/1297126.aspx