Hi All,
This means article says that SQLDatareader.item is Overidable. I tried to to create a custom class which inhherits the SQLDataReader, and came with the error that this class cannot be inherited.. Is any other way ?
Printable View
Hi All,
This means article says that SQLDatareader.item is Overidable. I tried to to create a custom class which inhherits the SQLDataReader, and came with the error that this class cannot be inherited.. Is any other way ?
The reason that that property is overridable is that it is inherited from the DbDataReader class. DbDataReader is the base class for all data readers and it defines that property, then each specific data reader class is supposed to override it. A member that's declared Overridable in a base class must be Overridable in any derived classes too.
The SqlDataReader class is not supposed to be inherited though. What would be the point of inheriting it? The only way you can create an instance is by calling ExecuteReader on a SqlCommand, so how would you ever instantiate your derived class?
Thanks for the Reply Jhon. The Problem is that I am working on project where they have used the SQLDatareader.item("") to get the value after executing the SQLDatareader.ExecuteReader method. They have not handled the null values from SQLData. I tried to start implementing checking for ISDBNull for each SQLDatareader.item("") of this line.
Instead of doing that i was looking for common method to implement for handling the Null values, So that If I declare the SQLDatareader in the Page Level and not in Function/Sub Level
So what was your intention? Return Nothing instead of a DBNull or something?
I need to return an Empty string if it is an DBNULL
Thanks John.. I miss read that .Tostring Will throw an Exception for DBNull.. Now tested with a Small Application working good..
Thanks once again...