473,387 Members | 1,485 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 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 1790
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Lauren Quantrell | last post by:
I have two columns in a table: StartDate DateTime and StartTime DateTime. The StartDate column holds a value such as 07/16/2004 The StartTime column holds a value such as 3:00:00 PM I want to...
16
by: PK9 | last post by:
I have a string variable that holds the equivalent of a DateTime value. I pulled this datetime from the database and I want to strip off the time portion before displaying to the user. I am...
5
by: Tom | last post by:
It appears that you can't compare two dates in DotNet. You must use ToString and compare the strings. Is that the only reliable way? Try this: Dim dteOne As Date =...
6
by: fniles | last post by:
I am using VB.NET 2003 and SQL Server 2000. I have a table with a datetime column type. When inserting into the table for that column, I set it to Date.Now.ToString("T") , which is something like...
5
by: Mike | last post by:
Hi, I use MS SQL Express and VS 2005 c#, win application. I would like to select value rom DateTimePicker and list all values for selected date within GridView. I have method as follows: ...
0
yasirmturk
by: yasirmturk | last post by:
Standard Date and Time Functions The essential date and time functions that every SQL Server database should have to ensure that you can easily manipulate dates and times without the need for any...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

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.