
May 13th, 2004, 05:01 AM
|
|
Contributing User
|
|
Join Date: Oct 2003
Location: UK
Posts: 78
 
Time spent in forums: 1 h 20 m 27 sec
Reputation Power: 5
|
|
|
DateTime type query
Hi All,
I'm having some problems updating my sql server table from my C# app. The table has a single DateTime column which is updated from the app using the query built using:-
oleDbCommand.CommandText = String.Format("UPDATE _User SET LastLoginDate={'0'}", DateTime.Now);
This query ran fine until today when it started failing saying that the datetime is invalid. The DateTime.Now returns (for me) a date in the format dd/mm/ccyy, for today that's 13/05/2004. The failure suggests that this is in the wrong format so I assume that at some point is believes that this date is in mm/dd/2004 format, for which 13/05/2004 is invalid and so it fails, which would explain why it's worked for the last week.
I'm pretty new to C# and I'm obviously missing some date formating trick somewhere. Could someone help? PLEASE!
Cheers
dex
|