Click here to Skip to main content
15,890,512 members
Please Sign up or sign in to vote.
5.00/5 (1 vote)
Hi everyone,
I'm doing a small ADO.NET/C# application using SQL Server Compact Edition.
There's a table with a DateTime field, and I want a query that filters data depending on time and date.

For example: I want all the rows with the time between 1:00 am and 2:00 am AND the date between 1/1/2010 and 10/1/2010.

How can I do it ? and where (in the application's DataTable using Select() method? or in the database?)
Posted
Updated 8-Jun-10 10:38am
v2

1 solution

Use a standard where query to filter between the two dates, and also AND in a datepart(hh, colname) filter for the time range.
 
Share this answer
 
Comments
Speed.Of.Light 8-Jun-10 17:06pm    
THAT EASY!!
Thanxxxx (I feel stupid)!

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900