asp页面:
<!--#include file="dsn.asp"-->
<html>
<head>
<title>课表查询</title>
</head>
<body>
<%
Set MyComm = Server.CreateObject("ADODB.Command")
with MyComm
.ActiveConnection = connstr 'MyConStr是数据库连接字串
.CommandText = "SelCou_teacher_TeaNo" '指定存储过程名
.CommandType = 4 '表明这是一个存储过程
.Prepared = true '要求将SQL命令先行编译
.Parameters.append .CreateParameter("@TeaNo",200,1,4,"20000001")
Set MyRst = .Execute
end with
Set MyComm = Nothing
'从第一个记录集中取值
UserName = MyRst(0)
'从第二个记录集中取值
if not MyRst is Nothing then
Set MyRst = MyRst.NextRecordset()
TeaName = MyRst(0)
CouName = MyRst(1)
nn=CStr(UserTel)
mm=CStr(UserMail)
response.write(nn)
response.write(mm)
end if
Set MyRst = Nothing
%>
</table>
</body>
</html>
sql存储过程:
use ManageDB
go
create proc SelCou_teacher_TeaNo
@TeaNo nvarchar(8)
as
select Teacher.TeaName AS '老师名称' , Course.CouName AS '课程名称'
from Course,OpenClass,Teacher
where Course.CouNo=OpenClass.CouNo
AND OpenClass.TeaNo=@TeaNo
AND OpenClass.TeaNo=Teacher.TeaNo
return
go
求各位大神帮我看看哪里出错了,我是菜鸟。so...希望大家可以解释一下哈!!拜托了各位
ASP
存储
------解决方案--------------------
Parameters.append .CreateParameter("@TeaNo",203,1,8,"20000001") SP的参数是nvarchar(8)的
因为 SP SelCou_teacher_TeaNo中返回的只有一个记录集