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)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • @Param注解的使用和解析「建议收藏」

    @Param注解的使用和解析「建议收藏」作用:用注解来简化xml配置的时候(比如Mybatis的Mapper.xml中的sql参数引入),@Param注解的作用是给参数命名,参数命名后就能根据名字得到参数值,正确的将参数传入sql语句中(一般通过#{}的方式,${}会有sql注入的问题)。实例说明:1,使用@Param注解  Mapper接口方法:publicintgetUsersDetail(@Param("u…

    2022年10月26日
  • 常用的垂直细分引擎工具

    常用的垂直细分引擎工具常用的垂直细分的引擎工具我们需要一些垂直细分的引擎工具,帮我们搞定更精准的信息。本文基于大家日常上网的需要,分类整理了不同检索需求的工具,主要包括:电子书、图片、网盘、音乐、工作机会以及商品价格检索。

    2022年7月3日
  • fec浅析_fec13

    fec浅析_fec13fec(ForwardErrorCorrection),向前纠错。fec主要用于在传输过程中,发现带宽时够的,但是会有丢包的情况。一般用于udp传输,比如webrtc传视频,视频会议传输视频。另外提一下的是,udp传输视频一般会把一帧视频分为很多个分组,为啥要分组,因为如果不分组,传输过程中丢失了任何一个分组,整帧数据就丢失了。按mtu以下的分组传输好处是,可以实现udt,和fec了。比如一帧分了5个分组,增加一个fec冗余包,当前面5个分组中丢失任何一个,都可以通过这个fec冗

    2022年8月11日
  • Google发布开源Java程序 给力CSS

    Google发布开源Java程序 给力CSS

    2021年8月21日
  • Authentication failure. Retrying – 彻底解决vagrant up时警告

    Authentication failure. Retrying – 彻底解决vagrant up时警告

    2022年2月9日
  • ureport2 mysql_springboot整合UReport2「建议收藏」

    ureport2 mysql_springboot整合UReport2「建议收藏」###1、首先新建一个springboot项目###可以用idea直接新建,也可以在spring-boot官方提供的生成器生成项目,生成地址是:[https://start.spring.io/][https_start.spring.io]###2、配置pom.xml###org.springframework.bootspring-boot-starter-jdbcmysqlmysql…

    2022年10月25日

发表回复

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

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