日期:2010-03-27 浏览次数:20950 次
ASP调用存储过程源码示例
以下是代码: <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <% Set conn = CreateObject("ADODB.Connection") strCon = "Provider=SQLNCLI;Password=sa;Persist Security Info=True;User ID=sa;Initial Catalog=Northwind;Data Source=127.0.0.1" conn.Open strCon Set cmd = Server.CreateObject("ADODB.Command") with cmd .ActiveConnection = conn ’数据库连接字串 .CommandText = "test2" ’指定存储过程名 .CommandType = 4 ’表明这是一个存储过程 .Prepared = true ’要求将SQL命令先行编译 .Parameters.append .CreateParameter("@val1",3,2,4) .Parameters.append .CreateParameter("@val2",3,2,4) .Execute Response.Write(cmd(0) & "_" & cmd(1))’2个output都出来了 Set rs = .Execute end with while not rs.eof response.Write(rs(1) & "<br/>") rs.movenext wend %> |