This one will also try to cast to
string. But the
as keyword returns null instead of throwing an exception if the conversion is not feasible:
doctor.Dr_Remarks = Reader["Dr_Remarks"] as string;
What you have to consider is:
Do you really want to get a null value back if the databas stored DBNull?
Or do you wish to branch into some error handling here?
Or do you branch anyway because of a null in Dr_Remarks?