D
Danny Ni
Hi,
I used SqlDataReader to retrieve a resultset from SQL server. Say the
SqlDataReader name is drEmployee, it has a DateTime field which I like to
convert it to ShortDate format.
I tried: drEmployee["HireDate"].ToShortDateString()
No go. Does not even compile
I tried: drEmployee["HireDate"].ToString()
It's working, but I don't like the time portion.
Seems to me drEmployee["HireDate"] is a System.Object, but how do I cast it
so I can use DateTime's methods?
TIA
I used SqlDataReader to retrieve a resultset from SQL server. Say the
SqlDataReader name is drEmployee, it has a DateTime field which I like to
convert it to ShortDate format.
I tried: drEmployee["HireDate"].ToShortDateString()
No go. Does not even compile
I tried: drEmployee["HireDate"].ToString()
It's working, but I don't like the time portion.
Seems to me drEmployee["HireDate"] is a System.Object, but how do I cast it
so I can use DateTime's methods?
TIA