不错呦!smile@林凯西,确保“准备文件”中的几个文件都有安装,S...您好,看了您这篇帖子觉得很有帮助。但是有个问题想请...我的修改过了怎么还被恶意注册呢 @jjjjiiii 用PJ快9年了,主要是A...PJ3啊,貌似很少有人用PJ了,现在不是WP就是z...@332347365,我当时接入时错误码没有-10...楼主,ChkValue值应为-103是什么意思呢?...大哥 你最近能看到我发的信息,请跟我联系,我有个制...
ASP中如何执行存储过程
编辑:dnawo 日期:2007-01-12
1.什么是存储过程?
存储过程是SQL server所提供的Tranact-SQL语言所编写的程序。
2. 如何建立存储过程?
Create PROCEDURE sp_query_info
@name1 varchar(20) ="张三"
AS
Select * from info where stu=@name1
GO
3. ASP中执行存储过程:
A. 编写sql语句:“execute 存储过程名 参数”,再通过connection.execute或recordset.open执行
Set objComm = Server.CreateObject("adodb.command")
objComm.CommandType = 1
objComm.ActiveConnection = objConn
objComm.CommandText = "execute sp_query_info '李四'"
Set objRs = objComm.execute
If not objRs.eof Then
Response.write objRs(1)
End if
Set objRs = Nothing
Set objComm = Nothing
B. 通command对象执行类型为acCmdStoredProc的命令
Set objComm = Server.CreateObject("adodb.command")
objComm.Parameters.append objComm.CreateParameter("@name1",200,1,50,"王五")
objComm.CommandType = 4
objComm.ActiveConnection = objConn
objComm.CommandText = "sp_query_info"
Set objRs = objComm.execute
If not objRs.eof Then
Response.write objRs(1)
End if
Set objRs = Nothing
Set objComm = Nothing
存储过程是SQL server所提供的Tranact-SQL语言所编写的程序。
2. 如何建立存储过程?
Create PROCEDURE sp_query_info
@name1 varchar(20) ="张三"
AS
Select * from info where stu=@name1
GO
3. ASP中执行存储过程:
A. 编写sql语句:“execute 存储过程名 参数”,再通过connection.execute或recordset.open执行
Set objComm = Server.CreateObject("adodb.command")
objComm.CommandType = 1
objComm.ActiveConnection = objConn
objComm.CommandText = "execute sp_query_info '李四'"
Set objRs = objComm.execute
If not objRs.eof Then
Response.write objRs(1)
End if
Set objRs = Nothing
Set objComm = Nothing
B. 通command对象执行类型为acCmdStoredProc的命令
Set objComm = Server.CreateObject("adodb.command")
objComm.Parameters.append objComm.CreateParameter("@name1",200,1,50,"王五")
objComm.CommandType = 4
objComm.ActiveConnection = objConn
objComm.CommandText = "sp_query_info"
Set objRs = objComm.execute
If not objRs.eof Then
Response.write objRs(1)
End if
Set objRs = Nothing
Set objComm = Nothing
评论: 1 | 引用: 0 | 查看次数: 4542
发表评论
请登录后再发表评论!