Click here to Skip to main content
15,922,696 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
sqldatareader dr=new sqldatareader
Posted

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 ?
 
Share this answer
 
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.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900