471,321 Members | 1,801 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,321 software developers and data experts.

Failed to compare Time portion of DateTime when read database

Hi all,
I have datetime field in database. When I am getting records older than
specific date that I passed in parameter I can not get records that
differs only in Time part of the datetime value.
Looks like comparison of Time portion in query failed.

I would appreciate any advice

Thanks,
Roman

Nov 29 '05 #1
3 1682
Roman,

Can you show how you are making the comparison? It's a little vague
from your description. Some code would help.
--
- Nicholas Paldino [.NET/C# MVP]
- mv*@spam.guard.caspershouse.com

<mu******@hotmail.com> wrote in message
news:11*********************@z14g2000cwz.googlegro ups.com...
Hi all,
I have datetime field in database. When I am getting records older than
specific date that I passed in parameter I can not get records that
differs only in Time part of the datetime value.
Looks like comparison of Time portion in query failed.

I would appreciate any advice

Thanks,
Roman

Nov 29 '05 #2
Nicholas, thank you for quick reply,

I am using ADO OleDbCommand and in Visual Studio QuickWatch clearly can
see that the record that am going to get is older than datetime in
TimestampParam by 10 sec (for example). If I substract 1 day from the
database field value I am getting the record. It is definetly time
part comparison failed.

myCommand.CommantText = SELECT [NetLog].* FROM [NetLog] WHERE
Timestamp < @TimestampParam

Nov 29 '05 #3
extracted some lines from my code to show how I am reading database

OleDbDataAdapter adapter = new OleDbDataAdapter();
myCommand.CommantText = "SELECT [NetLog].* FROM [NetLog] WHERE
Timestamp < TimestampParam"
adapter.SelectCommand = myCommand;
System.Data.DataSet dataSet = new System.Data.DataSet();
int iNumRows = adapter.Fill( dataSet );

Thanks

Nov 29 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

2 posts views Thread by Lauren Quantrell | last post: by
6 posts views Thread by fniles | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.