J
James
For some reason when I pass a .net datetime value to a sqlType
DateTime to a smalldatetime in sql server, any value that happens to
fall at exactly midnight drops the time portion and only stores the
date? If I trace or do any sort of ToString() on any of the values
during the process in the app, it shows the time correctly, but when I
look in the db I only see the date...
DateTime lastDate = new DateTime(2004,1,1,0,0,0);
// Snip set db access obj
db.daLastAccessedDate = new SqlDateTime(lastDate);
// Snip set sp parameter
scmCmdToExecute.Parameters.Add(new SqlParameter("@LastAccessedDate",
SqlDbType.SmallDateTime, 4, ParameterDirection.Input, false, 16, 0,
"", DataRowVersion.Proposed, m_daLastAccessedDate));
// nothing fancy in sql server -- only a smalldatetime.
Has anyone else seen this? I really don't want to kludge this by
adding one minute or something...
James
DateTime to a smalldatetime in sql server, any value that happens to
fall at exactly midnight drops the time portion and only stores the
date? If I trace or do any sort of ToString() on any of the values
during the process in the app, it shows the time correctly, but when I
look in the db I only see the date...
DateTime lastDate = new DateTime(2004,1,1,0,0,0);
// Snip set db access obj
db.daLastAccessedDate = new SqlDateTime(lastDate);
// Snip set sp parameter
scmCmdToExecute.Parameters.Add(new SqlParameter("@LastAccessedDate",
SqlDbType.SmallDateTime, 4, ParameterDirection.Input, false, 16, 0,
"", DataRowVersion.Proposed, m_daLastAccessedDate));
// nothing fancy in sql server -- only a smalldatetime.
Has anyone else seen this? I really don't want to kludge this by
adding one minute or something...
James