How to resolve the error message ‘Cannot implicitly convert type ‘string’ to ‘System.DateTime’ ‘ when using a DataReader

Platform: ASP.NET| Category: ADO.NET

Try

VB.NET


dim dt as DateTime = ctype( dr('hiredate').ToString(), DateTime)

C#


DateTime dt= ((DateTime) dr['hiredate']).ToString(); 

Share with

Related FAQs

Couldn't find the FAQs you're looking for?

Please submit your question and answer.