Hi aditya,
Indeed you need to use new to create instances of most objects. However, these objects must have a public constructor before you can new them.
The SqlDataReader does not have a public constructor; the only way to create new instances of the SqlDataReader is to call the ExecuteReader method on a SqlCommand object, which then creates the reader for you.
HtH,
Imar
---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
|