oracle的executereader,OracleCommand.ExecuteReader 方法 (System.Data.OracleClient) | Microsoft Docs…

oracle的executereader,OracleCommand.ExecuteReader 方法 (System.Data.OracleClient) | Microsoft Docs…public:System::Data::OracleClient::OracleDataReader^ExecuteReader(System::Data::CommandBehaviorbehavior);publicSystem.Data.OracleClient.OracleDataReaderExecuteReader(System.Data.CommandBehavior…

大家好,又见面了,我是你们的朋友全栈君。

public:

System::Data::OracleClient::OracleDataReader ^ ExecuteReader(System::Data::CommandBehavior behavior);

public System.Data.OracleClient.OracleDataReader ExecuteReader (System.Data.CommandBehavior behavior);

member this.ExecuteReader : System.Data.CommandBehavior -> System.Data.OracleClient.OracleDataReader

override this.ExecuteReader : System.Data.CommandBehavior -> System.Data.OracleClient.OracleDataReader

Public Function ExecuteReader (behavior As CommandBehavior) As OracleDataReader

参数

返回

示例

下面的示例创建一个 OracleCommand ,然后通过传递一个字符串(一个 SQL SELECT 语句)和一个用于连接到数据库的字符串来执行它。The following example creates an OracleCommand, and then executes it by passing a string that is an SQL SELECT statement, and a string to use to connect to the database.

public void CreateMyOracleDataReader(string queryString, string connectionString)

{

using (OracleConnection connection = new OracleConnection(connectionString))

{

OracleCommand command = new OracleCommand(queryString, connection);

connection.Open();

// Implicitly closes the connection because

// CommandBehavior.CloseConnection is specified.

OracleDataReader reader =

command.ExecuteReader(CommandBehavior.CloseConnection);

while (reader.Read())

{

Console.WriteLine(reader.GetValue(0));

}

reader.Close();

}

}Public Sub CreateMyOracleDataReader(ByVal queryString As String, _

ByVal connectionString As String)

Using connection As New OracleConnection(connectionString)

Dim command As New OracleCommand(queryString, connection)

connection.Open()

‘Implicitly closes the connection because

‘ CommandBehavior.CloseConnectionwas specified.

Dim reader As OracleDataReader = _

command.ExecuteReader(CommandBehavior.CloseConnection)

While reader.Read()

Console.WriteLine(reader.GetValue(0))

End While

reader.Close()

End Using

End Sub

注解

如果希望 SQL 语句仅返回一行,则将指定 SingleRow 为 CommandBehavior 值可以提高应用程序性能。If you expect your SQL statement to return only a single row, specifying SingleRow as the CommandBehavior value may improve application performance.

当 CommandType 属性设置为时 StoredProcedure ,应将 CommandText 属性设置为存储过程的名称。When the CommandType property is set to StoredProcedure, the CommandText property should be set to the name of the stored procedure. 然后,在调用时,该命令将执行此存储过程 ExecuteReader 。The command then executes this stored procedure when you call ExecuteReader.

OracleDataReader支持一种特殊模式,该模式允许有效读取较大的二进制值。The OracleDataReader supports a special mode that enables large binary values to be read efficiently. 有关详细信息,请参阅的 SequentialAccess 设置 CommandBehavior 。For more information, see the SequentialAccess setting for CommandBehavior.

OracleDataReader在任意给定时间,都可以打开多个。More than one OracleDataReader can be open at any given time.

适用于

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/151520.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • UML学习入门就这一篇文章

    1.1UML基础知识扫盲UML这三个字母的全称是UnifiedModelingLanguage,直接翻译就是统一建模语言,简单地说就是一种有特殊用途的语言。你可能会问:这明明是一种图形,为什么说是语言呢?伟大的汉字还不是从图形(象形文字)开始的吗?语言是包括文字和图形的!其实有很多内容文字是无法表达的,你见过建筑设计图纸吗?里面还不是很多图形,光用文字能表达清楚建筑设计吗?在建筑界,…

    2022年4月13日
    78
  • java认证考试题目_java程序员工资一般多少

    java认证考试题目_java程序员工资一般多少第一部分基础知识练习目标本章对应于《学生指南》各章的内容分别提供了练习题集,包括:●第一章Java入门●第二章数据类型和运算符●第三章流程控制与数组●第四章封装●第五章继承

    2022年8月3日
    21
  • FCoin“出事”后,团队关键人物回复了![通俗易懂]

    记者:李小平2月12日晚,FCoin交易所的一则“关于系统维护最新进度及开放提现申请”公告在社区引发巨大争议。公告称:一、经核查,系统未曾遭受过外部黑客入侵。二、由于团队关键人员失联,以…

    2022年4月6日
    67
  • treap模版_bartender模板

    treap模版_bartender模板#include#include#include#include#include#include#include#include#include#include#include#include#include#include#includeusingnamespacestd;typedefintll;typedefunsignedlonglongu

    2025年7月22日
    0
  • myeclipse8.5注册码怎么用_java生成不重复验证码

    myeclipse8.5注册码怎么用_java生成不重复验证码注册码:用户名:myeclipse5.5注册码:zLR7ZL-655444-60536056302480798注册机代码:importjava.io.BufferedReader;importjava.io.IOException;importjava.io.InputStreamReader;importjava.io.PrintStream;

    2022年9月30日
    0
  • Python读txt(python打开txt文件)

    python读写txt文件准备原始txt数据3.14159265358979323846264338327950288419716939937510582097494459230781640628620899862803482534211706798214808651328230664709384460955058223172535940812848111745028410270193852110…

    2022年4月17日
    65

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号