Wrox Programmer Forums
|
Classic ASP Databases Discuss using ASP 3 to work with data in databases, including ASP Database Setup issues from the old P2P forum on this specific subtopic. See also the book forum Beginning ASP.NET Databases for questions specific to that book. NOT for ASP.NET 1.0, 1.1, or 2.0.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Classic ASP Databases section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old October 28th, 2004, 11:26 PM
SoC SoC is offline
Authorized User
 
Join Date: Jul 2004
Posts: 65
Thanks: 0
Thanked 0 Times in 0 Posts
Default Searching datetime field

Hi,

I have a SQL database table with a datetime field in dd/mm/yyyy
format.

I have a web page that allows users to search this database.

How do you search a datetime field?

i.e., I want users to be able to enter a date into a text
field that will search the database.

I know it's not as simple as saying SELECT * FROM TABLE WHERE
dateField = theTextFieldVariable.

Any help much appreciated

S

 
Old October 29th, 2004, 11:12 AM
Friend of Wrox
 
Join Date: Jan 2004
Posts: 303
Thanks: 0
Thanked 0 Times in 0 Posts
Default

what's problem with "SELECT * FROM Table WHERE dateField = 'dd/mm/yyyy'?

You can also search date range using "BETWEEN' and "AND" predicate.
For e.g. ..WHERE dateField BETWEEN 'your_start_date' AND 'your_end_date'

 
Old October 29th, 2004, 10:38 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 2,480
Thanks: 0
Thanked 1 Time in 1 Post
Default

Hi SoC,

Whatever the date format being used in the frontend, convert it to a format that is similar to that od the date in database. Else use a standard format throughout the application. When dd/mm/yyyy is the format used in DB, you can use the same from the frontend too. Otherwise, follow the "yyyy-mm-dd" format.

Post here if you face any problem in doing so.

Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to Use DateTime Field kcsathish ASP.NET 2.0 Professional 0 July 15th, 2008 01:01 AM
Datetime Field as index daworm MySQL 2 September 17th, 2006 11:33 PM
Text to DateTime Field lenredles SQL Server 2000 1 March 6th, 2006 10:09 PM
How do you search datetime field? SoC Classic ASP Basics 6 October 31st, 2004 09:39 PM
Query DateTime Field mtalam Access 5 June 3rd, 2004 06:51 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.