ASP之简化创建关闭记录集对象并创建使用简单的MSSQL存储过程

  ASP 技巧一则之 简化创建关闭记录集对象并创建使用简单的MSSQL存储过程 By shawl.qiu

  1. 建造 创建关闭记录集函数

  2. 在MSSQL查询分析器中创建简单的MSSQL存储过程

  3. 在ASP中应用步骤1,2

  shawl.qiu

  2006-8-26

  http://blog.csdn.net/btbtd

  1. 建造 创建关闭记录集函数

  linenum

  function createRs(rs)

  set rs=createObject("adodb.recordset")

  end function

  function closeRs(rs)

  rs.close

  set rs=nothing

  end function

  2. 在MSSQL查询分析器中创建简单的MSSQL存储过程

  linenum

  create proc dbo.at_sbcat_t1

  as

  begin

  select * from ctatsbcat order by sbcat

  end

  3. 在ASP中应用步骤1,2

  linenum

  <%        dim rs

  call createRs(rs)

  with rs

  .open "exec dbo.at_sbcat_t1",conn

  do until .eof

  response.write rs("sbcat")&"<br/>"

  .movenext

  loop

  end with

  call closeRs(rs)

  %>