Click here to Skip to main content
15,913,115 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i want code to convert from sqldatetime to system.data.datetime
Posted

1 solution

All you need to do is cast the value, e.g.
DateTime myTime = (DateTime)resultSet[0];
If the database can contain a nullable DateTime, you need to cast it back to a nullable type, so the above query would be
C#
DateTime? myTime = (DateTime?)resultSet[0];
 
Share this answer
 
Comments
Uday P.Singh 21-Jul-11 11:28am    
good answer my 5!
Gordon Beeming 21-Jul-11 15:38pm    
Nice, 5

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900