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 July 16th, 2004, 11:19 AM
Authorized User
 
Join Date: Jul 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Night_Zero
Default Getting A date from access

Well guys I've tried everything I can think of to get a date from access but it always says data mismatch. And in the database it shows a date like this: 9/11/00 Here's a list:

sql = "SELECT [Assigned] FROM [Password] WHERE [Assigned] = '091100'"
sql = "SELECT [Assigned] FROM [Password] WHERE [Assigned] = '09/11/00'"
sql = "SELECT [Assigned] FROM [Password] WHERE [Assigned] = '9/11/00'"


And every possible combination of those. Any ideas cause I got none now. Oh, I also tried #9/11/00# and #91100# which is the way Access lists it when I make a query.

 
Old July 16th, 2004, 08:56 PM
Friend of Wrox
 
Join Date: Sep 2003
Posts: 363
Thanks: 0
Thanked 1 Time in 1 Post
Default

hello,
  date is queried in access using #01/01/2004# not in quotes.

sql = "SELECT [Assigned] FROM [Password] WHERE [Assigned] = #09/11/2000#"


 
Old July 19th, 2004, 09:25 AM
Authorized User
 
Join Date: Jul 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Night_Zero
Default

Thanks man, that worked. Appreciate it.

 
Old July 19th, 2004, 09:55 AM
Authorized User
 
Join Date: Jul 2004
Posts: 45
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via AIM to Night_Zero
Default

Actually, I do need to ask one more favor. How do you use the now/today function in that? I tried #Now()# but that didn't work. I got the page to load by doing sql = "SELECT [Assigned] FROM [Password] WHERE [Assigned] = Now()"

But I don't know will that be the date or just the text 'Now()'?

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

Hello,
When you compare for a date string(of any format that you use) you got to use # around it. When you compare that with a NOW(), you don't need # around it, as it is in-built function of ACCESS.

Correct usage - SELECT [Assigned] FROM [Password] WHERE [Assigned] = Now()

You can test all possiblities by executing them directly on your ACCESS db.

Hope that helps.
Cheers!

_________________________
- Vijay G
Strive for Perfection





Similar Threads
Thread Thread Starter Forum Replies Last Post
Access Date Problem jjc9809 Access VBA 3 November 9th, 2007 02:03 PM
A Date in Access PaulC999 Classic ASP Databases 1 January 4th, 2007 07:46 PM
Logged in Date to Access myself Classic ASP Basics 0 June 10th, 2006 01:58 PM
retrieve from Access by Date Toran Classic ASP Databases 2 May 4th, 2005 12:53 AM
Date query in Access Andrew Antoniak Access 2 January 21st, 2004 06:07 AM





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