String was not recognized as a valid DateTime.

Last Reply on Mar 20, 2012 01:04 AM By Mudassar

Posted on Mar 20, 2012 01:03 AM

 dr("Working_Hour") = (Convert.ToDateTime(dr(4)) - Convert.ToDateTime(dr(3))) + (Convert.ToDateTime(dr(6)) - Convert.ToDateTime(dr(5))) + (Convert.ToDateTime(dr(8)) - Convert.ToDateTime(dr(7)))

here dr is data row ,

how can i remove this error

Posted on Mar 20, 2012 01:04 AM Modified on on Mar 20, 2012 01:05 AM

This error comes due to following reasons

1. The value returned from database is NULL

2. The value returned has some spaces

3. The value returned is not valid datetime

Thus you will need to add breakpoint and check values of all columns returned from database

I agree, here is the link: https://www.e-iceblue.com/Introduce/spire-office-for-net-free.html