<!--#include file="connsecond.asp"-->
<%
Dim cmd
Dim adCmdSPStoredProc
Dim adParamReturnValue
Dim adParaminput
Dim adParamOutput
Dim adInteger
Dim iVal
Dim oVal
Dim adoField
Dim adVarChar
'这些值在 VB 中是预定义常量,可以直接调用,但在 VBScript 中没有预定义
adCmdSPStoredProc = 4
adParamReturnValue = 4
adParaminput = 1
adParamOutput = 2
adInteger = 3
adVarChar = 200
adSingle=4 '单精度浮点小数
adDBTimeStamp=135
'执行储存过程
dim HL_HouseID
set cmd = Server.CreateObject("adodb.command")
for HL_ID=1 to 4
with cmd '五个参数(参数名、参数数据类型、参数类型、数据长度、参数值。声明输出参数时,没有最后一个参数:参数值)
.ActiveConnection=Conn 'conn是数据库连接字串
.CommandText = "sp_HouseLeaseInfo_read" '指定存储过程名
.CommandType =adCmdSPStoredProc '表明这是一个存储过程(adCmdSPStoredProc=4)
.Prepared= true '要求将SQL命令先行编译
if HL_ID=1 then
.Parameters.Append .CreateParameter("@HL_ID",adInteger,adParaminput,3,HL_ID)'房屋出租信息表主键ID号
.Parameters.Append .CreateParameter("@HL_HouseID ",adVARCHAR,adParamoutput,20)'*房源编号
.Parameters.Append .CreateParameter("@HL_Commerce ",adVARCHAR,adParamoutput,20)'房源所在商业圈
.Parameters.Append .CreateParameter("@HL_HtmlUrl ",adVARCHAR,adParamoutput,2000)'静态页面存储路径
.Parameters.Append .CreateParameter("@return_ok",adVarchar,adParamOutput,1) '静态页面存储路径
'执行存储过程
.Execute()
else
.Parameters("@HL_ID")=HL_ID
.Execute
end if
End with
return_ok=cmd("@return_ok") '为什么取@return_ok作为返回值?因为这是在存储过程里面程序员定义的
IF return_ok="1" Then '返回1表示存储过程执行成功,反之,执行失败
HL_Commerce=cmd("@HL_Commerce")
HL_HtmlUrl=cmd("@HL_HtmlUrl")
End IF
%>
<TD vAlign=middle align=left height=20><IMG src=\"images/news.jpg\" align=absMiddle>
<a href=">http://www.2sf.com.cn/house/bj/sale/<%=HL_HtmlUrl%> title=<%=HL_Commerce%> target="_blank" class="wangzhan"><%=ShowSubStr(HL_Commerce,12,"")%></a></TD>
<% next
'释放资源
Set cmd.ActiveConnection = nothing
Set cmd = nothing
Conn.close
Set Conn=Nothing
%>
提示的错误是:Microsoft OLE DB Provider for SQL Server 错误 '80004005'
语法错误或访问冲突
/second_news.asp,行50 (即为红色字体的那行)
请高手指点 谢谢