Re: Loss of Precision in DateTime
From: William Ryan eMVP (dotnetguru_at_comcast.nospam.net)
Date: 07/19/04
- Next message: Mary Chipman: "Re: Report"
- Previous message: Ibrahim Shameeque: "RE: How to Handle Nulls"
- In reply to: James: "Loss of Precision in DateTime"
- Next in thread: James: "Re: Loss of Precision in DateTime"
- Reply: James: "Re: Loss of Precision in DateTime"
- Messages sorted by: [ date ] [ thread ]
Date: Mon, 19 Jul 2004 09:51:16 -0400
How are you verifying it? ARe you looking in Enterprise manager or QA? If
it's showing in EM like that - it's not a problem - to verify it, do a
SELECT WhateverColumn from yourTable in QA and you should see the times as
well. If it's a varchar or something you could have a problem, but if it's
DateTime - it can't physically be stored without the Time although it may
'look' like it. If it's showing that way client side, again it may well
just be a formatting issue. So check the datasource(datatable or
datareader) and see that the actual value is before you check the contorl or
UI tool that's displaying it.
HTH,
Bill
-- W.G. Ryan, eMVP Have an opinion on the effectiveness of Microsoft Embedded newsgroups? Let Microsoft know! https://www.windowsembeddedeval.com/community/newsgroups "James" <jtaylor1024@hotmail.com> wrote in message news:f2d8a605.0407190515.396adc1c@posting.google.com... > 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
- Next message: Mary Chipman: "Re: Report"
- Previous message: Ibrahim Shameeque: "RE: How to Handle Nulls"
- In reply to: James: "Loss of Precision in DateTime"
- Next in thread: James: "Re: Loss of Precision in DateTime"
- Reply: James: "Re: Loss of Precision in DateTime"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|