Simon,
a) Writing rdr.GetValue(15) is the same as writing rdr[15] - at runtime,
this may be a string, a DateTime or an int, but at compile time you have an
Object, and you will need the cast (or the conversion) in order for the code
to compile.
b) If you know that the 16th field is a DateTime, you can use
rdr.GetDateTime(15) which returns directly a DateTime (no cast or conversion
necessary).
c) Does your stored procedure produce in the 16th field a SQL Server
DATETIME, or a string which represents a date (and/or a time)? If it is a
string, then the cast to (DateTime) will fail (because the object is a
string, not a DateTime); the call to Convert.ToDateTime() will succeed,
provided that the string really contains the representation of a date/time.
d) Regarding the Int16, if the SP returns a small int the following code:
Int16 varI = rdr.GetInt16(10);
should work.
In general, when using data readers I prefer to rely on the specific methods
(GetInt16, GetDateTime, etc.) whenever I know the structure of the data at
hand. Only if writing some kind of "generic" read I use GetValue():
Regarding the Convert class, I avoid using it and generally succeed on that.
It reminds me of the times of VB6 and the abuse of conversions between
types. But that's only a personal opinion.
Regards - Octavio