文章分类 | 推荐文章 | 最新文章 | 热点文章 | 最新软件 | 精品软件 | 下载排行 | 推荐下载 | 免费看大片 | WPS | 杀毒软件
清风网络
首 页 软件下载 网络学院 数码学院
QQ 电脑入门 游戏 操作系统 图形处理 办公软件 媒体动画 精文荟萃 工具软件 网络编程 程序开发 网络技术 认证考试 网站建设 文章专栏
当前位置:清风网络学院网络编程Asp.Net.NET调用Oracle存储过程,使用数组类型的参数(如ArrayList)
精品推荐
特别推荐
·技巧实例:ASP.NET生成静态页面实现方法
·ASP.NET、JSP及PHP之间的抉择
·.net基础知识错误注意二十二点知识
·asp.net2.0学习历程 菜鸟到中级程序员的飞跃
·.NET基础知识-什么是.NET
·初学C#+ASP.NET+Oracle时积累的备忘点滴
·专家详解:复杂表达式的执行步骤
·asp.net中的加密方法
·DataGrid常见关注问题解决方案
·学习笔记 ASP.NET 5种页面转向法
·ASP.NET网络编程中经常会用到的27个函数集
·ASP.NET之上传文件管理策略
·专家:用.NET动态创建类的实例讲解
·ASP.NET WEB服务和Flash打造MP3播放器
·精通ASP.NET中弹出窗口技术
·asp.net常用代码
·asp.net创建文件夹的IO类的问题
·Asp.Net函数集
·Asp.net cache 简述
·如何最大限度提高.NET的性能 (续)
热点TOP10
·DataTable控件的使用
·ASP.NET上传文件的实例
·ASP.NET2.0下含有DropDownList的GridView编辑、删除的完整例子!
·asp.net(C#)海量数据表高效率分页算法(易懂,不使用存储过程)
·ASP.NET购物车的实现及结算处理
·在ASP.NET中防止注入攻击[翻译]
·使用ASP.NET2.0的ReportViewer查看RDLC报表
·asp.net程序中最常用的三十三种编程代码
·ASP.NET 2.0的导航控件treeview和menu的实例
·asp.net常用代码
·在C#后代码里使用IE WEB Control TreeView
·Lucene.net 实现全文搜索
·asp.net2.0学习历程 菜鸟到中级程序员的飞跃
·Access 通用数据访问类(asp.net 2.0 c#)
·.Net分页控件发布
·ASP.NET之上传文件管理策略
·AspNetPager分页控件--使用方法
·asp.net 2.0中gridview里嵌套dropdownlist
·ASP.net在线购物商城系统完全解析
·手把手教你在Win2003下配置ASP.NET开发环境

.NET调用Oracle存储过程,使用数组类型的参数(如ArrayList)

日期:2007年6月10日 作者: 查看:[大字体 中字体 小字体]


今天一个项目组的朋友问及:如何在.NET中调用Oracle的存储过程,并以数组作为参数输入。

Oracle的PL/SQL非常强大,支持定长数组和变长数组,支持任何自定义数据类型。通过阅读ODP的文档,发现Oracle是完全支持将数组作为存储过程参数的。下面给出文档信息。

Array Binding
The array bind feature enables applications to bind arrays of a type using the OracleParameter class. Using the array bind feature, an application can insert multiple rows into a table in a single database round-trip.

The following example inserts three rows into the Dept table with a single database round-trip. The OracleCommand ArrayBindCount property defines the number of elements of the array to use when executing the statement.


// C#
 
using System;
using System.Data;
using Oracle.DataAccess.Client;
 
class ArrayBindSample
{
  static void Main()
  {
    OracleConnection con = new OracleConnection();
    con.ConnectionString = "User Id=scott;Password=tiger;Data Source=oracle;";
    con.Open();
    Console.WriteLine("Connected successfully");
 
    int[] myArrayDeptNo = new int[3] { 10, 20, 30 };
    OracleCommand cmd = new OracleCommand();
 
    // Set the command text on an OracleCommand object
    cmd.CommandText = "insert into dept(deptno) values (:deptno)";
    cmd.Connection = con;
 
    // Set the ArrayBindCount to indicate the number of values
    cmd.ArrayBindCount = 3;
 
    // Create a parameter for the array operations
    OracleParameter prm = new OracleParameter("deptno", OracleDbType.Int32);
 
    prm.Direction = ParameterDirection.Input;
    prm.Value = myArrayDeptNo;
 
    // Add the parameter to the parameter collection
    cmd.Parameters.Add(prm);
 
    // Execute the command
    cmd.ExecuteNonQuery();
    Console.WriteLine("Insert Completed Successfully");
 
    // Close and Dispose OracleConnection object
    con.Close();
    con.Dispose();
  }
}


See Also:

"Value" for more information


OracleParameter Array Bind Properties
The OracleParameter class provides two properties for granular control when using the array bind feature:

ArrayBindSize

The ArrayBindSize property is an array of integers specifying the maximum size for each corresponding value in an array. The ArrayBindSize property is similar to the Size property of an OracleParameter object, except the ArrayBindSize property specifies the size for each value in an array.

Before the execution, the application must populate the ArrayBindSize property; after the execution, ODP.NET populates it.

The ArrayBindSize property is used only for parameter types that have variable length such as Clob, Blob, and Varchar2. The size is represented in bytes for binary datatypes, and characters for the Unicode string types. The count for string types does not include the terminating character. The size is inferred from the actual size of the value, if it is not explicitly set. For an output parameter, the size of each value is set by ODP.NET. The ArrayBindSize property is ignored for fixed-length datatypes.

ArrayBindStatus

The ArrayBindStatus property is an array of OracleParameterStatus values that specify the status of each corresponding value in an array for a parameter. This property is similar to the Status property of the OracleParameter object, except that the ArrayBindStatus property specifies the status for each array value.

Before the execution, the application must populate the ArrayBindStatus property. After the execution, ODP.NET populates the property. Before the execution, an application using the ArrayBindStatus property can specify a NULL value for the corresponding element in the array for a parameter. After the execution, ODP.NET populates the ArrayBindStatus property, indicating whether the corresponding element in the array has a null value, or if data truncation occurred when the value was fetched.



[1] [2] [3] [4] [5] 下一页 




上一篇:mscorwks.dll在.Net中的地位以及在.Net代码保护方面的应用

下一篇:系统解答:引导或系统启动驱动程序无法加载

.NET调用Oracle存储过程,使用数组类型的参数(如ArrayList) 相关文章:
·GHOST使用方法(图解)
·Vista系统使用技巧总结
·无线攻防:破解WEP密钥过程全解
·为什么iexplore.exe在打开网页时CPU使用会100%?
·用SOFTICE破解WINZIP的过程
·QQ空间导航代码最新版使用方法
·DataTable控件的使用
·推荐:漂亮的手机上使用的墙纸图片分享下载
·腾讯QQ号码使用完全指南
·详细介绍ORACLE sqlplus命令
.NET调用Oracle存储过程,使用数组类型的参数(如ArrayList) 相关软件:
·黑客视频教程 VMware虚拟机的安装和使用
·黑客视频教程-灰鸽子远控使用教程
·使用GPMC随心所欲管理组策略
·FLASH 8中文使用手册
·Adobe Photoshop CS 2 简体中文使用指南
·Auto CAD R14高级使用教程
·Oracle v8.1.7
·Microsoft Visio 2000 完全使用手册
·Linux 系统命令及其使用详解(大全)
·西门子plc软件及教程 文件类型 其它介绍

特别声明:本站除部分特别声明禁止转载的专稿外的其他文章可以自由转载,但请务必注明出处和原始作者。文章版权归文章原始作者所有。对于被本站转载文章的个人和网站,我们表示深深的谢意。如果本站转载的文章有版权问题请联系编辑人员,我们尽快予以更正。
[打印本页] [关闭窗口] 转载请注明来源:http://www.viphot.com
| 帮助(?) | 版权声明 | 友情连接 | 关于我们 | 信息发布
Copyright 2007 www.viphot.com All Rights Reserved. 鄂ICP备05000083号Powered by:viphot