为什么我们不能使用sqldatareader dr = new sqldatareader [英] why we cannot use sqldatareader dr=new sqldatareader

查看:100
本文介绍了为什么我们不能使用sqldatareader dr = new sqldatareader的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

sqldatareader dr = new sqldatareader

sqldatareader dr=new sqldatareader

推荐答案

因为它没有公共构造函数.这意味着它被设计为由另一个对象创建.我不能打扰地阅读MSDN并查看您应该如何使用它,也许您可​​以自己尝试一下呢?
Because it has no public constructor. That means it''s designed to be created by another object. I can''t be bothered googling to read the MSDN and see how you''re supposed to use it, perhaps you could try that for yourself ?


因为SqlDataReader已经指向一个打开连接和打开查询.在SQLCommand对象上执行ExecuteReader()时,将获得SqlDataReader.

http://msdn.microsoft.com/en-us/library/system. data.sqlclient.sqldatareader.aspx

您可以将SqlDataReader视为指向等待读取的返回数据集的指针.
Because the SqlDataReader already points to an open connection and an open query. You get the SqlDataReader when you ExecuteReader() on the SQLCommand object.

http://msdn.microsoft.com/en-us/library/system.data.sqlclient.sqldatareader.aspx

You could consider an SqlDataReader as a pointer to the returned dataset waiting to be read.


这篇关于为什么我们不能使用sqldatareader dr = new sqldatareader的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆