首 页 | 精品电影 | 音乐天堂 | 在线游戏 | Flash MTV | 三湘书屋 | 幽默笑话 | 三湘图库 | 美女写真 | IT知识库 | QQ贴图 | 加入书签

网页制作网络编程图形图象操作系统冲浪宝典软件教学网络安全认证考试通信技术电子商务业内动态书籍教程原码

最近更新 文章分类 多媒体类 精品软件

本站搜索:
您的位置:三湘时空 -> IT知识库 -> 文章分类 -> ASP技巧 -> ASP调用ORACLE存储过程并返回结果集  
ASP调用ORACLE存储过程并返回结果集


文章类别:ASP技巧 来源: 作者: 发表日期:2005-10-4 字体:[ ]

小游戏 | 在线影院 | 幽默笑话 | 源码下载 | Flash MTV | 音乐试听 | 书屋 | 美女写真

ASP 调用 ORACLE存储过程并返回结果集

看过网上好多ASP调用ORACLE的方法,但是没有特好特直接的东西,所以总结各家的东西最后得出的一个自己需要的方法,感觉也比较大众所以特此发布

###################################################
oracle的存储过程
###################################################

--创建包头
create or replace package pck_as
as
  type t_product_id is table of number
  index by binary_integer;
  type t_serial_no is table of varchar(300)
  index by binary_integer;
  type t_buy_date is table of date
  index by binary_integer;
 
  procedure allsfc
  (
   product_id out t_product_id,
   serial_no out t_serial_no,
   buy_date out t_buy_date
  );
 
  --procedure allsfc1;
end pck_as;


--创建包体
create or replace package body pck_as
as
  procedure allsfc
  (
   product_id out t_product_id,
   serial_no out t_serial_no,
   buy_date out t_buy_date
  )
  is
    cursor cur_sfc_tbl_product_reg is
    select product_id,serial_no,buy_date from sfc_tbl_product_reg;
   
    i number default 1;
   
  begin
       for onrecord in cur_sfc_tbl_product_reg
       loop
            product_id(i) := onrecord.product_id;
            serial_no(i) := onrecord.serial_no;
            buy_date(i) := onrecord.buy_date;
            i := i + 1;
       end loop;
  end;
end;

 


###################################################
ASP的调用
###################################################
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
</head>

<body>
<%
dim str_ora
dim objconn_ora
str_ora = "Driver={Microsoft ODBC for Oracle};Server=ora192;uid=dwuser;pwd=family.samsung.com.cn"
set objconn_ora = server.CreateObject("adodb.connection")
objconn_ora.connectionstring = str_ora
objconn_ora.CursorLocation = 3
objconn_ora.open

dim strsql
set rs1 = server.CreateObject("ADODB.RecordSet")
strsql = "{call pck_as.allsfc({resultset 90000, product_id, serial_no, buy_date})}"
set objcomm1 = server.CreateObject("adodb.command")
objcomm1.activeconnection = objconn_ora
objcomm1.commandtype = 1
objcomm1.commandtext = strsql
set rs1 = objcomm1.execute


while not rs1.eof
 response.Write(rs1(0) & "|" & rs1(1) & "|" & rs1(2) & "|<BR>")
 rs1.movenext
wend
%>
</body>
</html>

上一篇:偷梁换柱大法:给RMVB影视添加字幕 下一篇:将ASP的Debug变得简单的两个函数
本栏目热门文章
·WEB打印设置解决方案二(利用ScriptX.cab控件改变IE打印 2005-10-4
·WEB打印设置解决方案三(FileSystem组件实现WEB打印) 2005-10-4
·使用VBScript操作Html复选框(CheckBox)控件 2005-10-4
·automation服务器不能创建对象 2006-1-6
·HTTP_REFERER的工作方式 2005-10-4
·用ASP和Microsoft.XMLDOM分析远程XML文件 2005-10-4
·XMLHTTP Get HTML页面时的中文乱码之完全客户端Scri 2005-10-4
·使用ActiveX控件开发网页常见的问题 2005-10-4
·关于 aspsmartupload 注册问题 2005-10-4
·判断checkbox是否至少有选择一项 2005-10-8
新近更新文章
·ASP网站漏洞解析及黑客入侵防范方法 2006-6-22
·将asp页面转换成htm页面 2006-6-20
·使用JMail组件代替Sql Mail发送Email 遇到的问题 2006-6-15
·Ajax & XMLHttpRequset 2006-6-15
·如何让图片自动缩放以适合界面大小 2006-6-15
·用正则解析图片地址,并利用XMLHTTP组件将其保存 2006-6-15
·用ASP+CSS实现随机背景 2006-6-4
·关于Cookie跨域操作遇到的问题及解决方法 2006-6-4
·编写数据库操作类,使ASP.NET中的数据库操作变得简单 2006-5-22
·一个简单的用存储过程分页 2006-5-18
首 页 | 软件发布 | 广告联系 | 下载帮助 | 意见反馈 | 网站地图
  CopyRight? 2002-2004 WWW.SXSKY.NET? All Rights Reserved
三湘时空 站长QQ:82675303 Email: