Home » FAQ » ASP.NET » ADO.NET » How to resolve the error message ‘Cannot implicitly convert type ‘string’ to ‘System.DateTime’ ‘ when using a DataReader
Try
VB.NET
dim dt as DateTime = ctype( dr('hiredate').ToString(), DateTime)
C#
DateTime dt= ((DateTime) dr['hiredate']).ToString();
Platform BlazorASP.NETWinFormsWPF.NET MAUI
Question *
Answer (Optional)
Email (Optional)
Email address is only for further clarification on your FAQ request. It will not be used for any other purpose.
Please leave this field empty.
Share with