加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 大数据 > 正文

vb.net – 将使用应用于SqlDataReader

发布时间:2020-12-17 00:31:04 所属栏目:大数据 来源:网络整理
导读:我只想验证一些事情.我相信如果我将using命令应用于SqlDataReader,它将关闭数据读取器并处理它.例如: Using sdr As SqlDataReader = cm.ExecuteReader() Dim someInt As Integer = sdr.GetInt32(0) 'other details and actionsEnd Using 是否会在退出Using
我只想验证一些事情.我相信如果我将using命令应用于SqlDataReader,它将关闭数据读取器并处理它.例如:
Using sdr As SqlDataReader = cm.ExecuteReader()
   Dim someInt As Integer = sdr.GetInt32(0)
   'other details and actions
End Using

是否会在退出Using代码块后关闭sdr SqlDataReader. (我相信它会,但只是想验证.)

是.使用IDisposable.Dispose调用,MSDN page on SqlDataReader.Dispose说:

SqlDataReader.Dispose Method

Releases the resources used by the DbDataReader and calls Close.

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读