Click here to Skip to main content
15,905,427 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
dateFrom = DateTime.ParseExact(dr["DateFrom"], "dd/MM/yyyy", CultureInfo.InvariantCulture);

There's an error,has some invalid argument. Not sure what's the error
Posted
Comments
Member 10434230 31-Jan-14 7:41am    
Is your problem resolved?

dateFrom = DateTime.ParseExact(Convert.ToString(dr["DateFrom"]), "dd/MM/yyyy", CultureInfo.InvariantCulture);
 
Share this answer
 
The DateFrom output is an object, not a string, which is what ParseExact expects.
C#
dateFrom = DateTime.ParseExact(dr["DateFrom"].ToString(), "dd/MM/yyyy", CultureInfo.InvariantCulture);
 
Share this answer
 
Read this
http://msdn.microsoft.com/en-us/library/w2sa9yss(v=vs.110).aspx[^]

Google is your friend, try him. However read this article, try out the examples by your own.
 
Share this answer
 

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