Web Wiz - Green Windows Web Hosting

  New Posts New Posts RSS Feed - Problem with dates
  FAQ FAQ  Forum Search   Events   Register Register  Login Login

Problem with dates

 Post Reply Post Reply Page  12>
Author
stevem2003 View Drop Down
Newbie
Newbie
Avatar

Joined: 07 November 2003
Location: United Kingdom
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevem2003 Quote  Post ReplyReply Direct Link To This Post Topic: Problem with dates
    Posted: 14 April 2004 at 9:05am

Hi,

I have an access db with the following fields; dbdate, name1, name2 & id.
If the field dbdate holds a date, how can I use ASP to display those records on a particular date?
ie. If dbdate = todays date, then display those records

I have tried using Cdate but I'm obviously doing something wrong.

Please Help

Steve

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2004 at 9:18am
Correct me if I'm wrong (havent used access for a while). But I think you do SELECT x FROM x WHERE x = #14/4/2004#
Back to Top
stevem2003 View Drop Down
Newbie
Newbie
Avatar

Joined: 07 November 2003
Location: United Kingdom
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevem2003 Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2004 at 9:30am

Hi Mart,

Yes that is correct, sorry maybe I assummed too much when asking the question.
e.g.

On 14/4/2004 name1 = pete, name2 = steve
On 15/4/2004 name1 = mike, name2 = pete.

What I need is a script that will pull data from the database whatever is equal to the current date, as I will have a record for every day of the year.

Many Thanks
Steve

Back to Top
michael View Drop Down
Senior Member
Senior Member
Avatar

Joined: 08 April 2002
Location: United States
Status: Offline
Points: 4670
Post Options Post Options   Thanks (0) Thanks(0)   Quote michael Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2004 at 9:40am

'You connection stuff goes here
strSQL = "Select * from yourtable where dbdate = '#" & date() & "#'"
'Execute that stuff
Back to Top
stevem2003 View Drop Down
Newbie
Newbie
Avatar

Joined: 07 November 2003
Location: United Kingdom
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevem2003 Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2004 at 10:07am

Hi,

Using that code I get the following error:-

Microsoft OLE DB Provider for ODBC Drivers error '80040e07'

[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression

The line with the error, looks like this:-

rs.open strSQL, conn, 3, 3

The whole connection script looks like:-


<%
dim conn, rs, strconn, strSQL

strconn = "DRIVER=Microsoft Access Driver (*.mdb);DBQ=" & Server.MapPath("database.mdb")
set conn = server.createobject("adodb.connection")
conn.open strconn
strSQL = "Select * from roster where dbdate = '#" & date() & "#'"
set rs = server.createobject("adodb.recordset")
rs.open strSQL, conn, 3, 3
%>

What am I doing wrong?

Back to Top
Mart View Drop Down
Senior Member
Senior Member
Avatar

Joined: 30 November 2002
Status: Offline
Points: 2304
Post Options Post Options   Thanks (0) Thanks(0)   Quote Mart Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2004 at 10:16am
What's the , 3, 3 all about... Try just with rs.open strSQL, conn.
Back to Top
zaboss View Drop Down
Senior Member
Senior Member


Joined: 20 August 2002
Location: Romania
Status: Offline
Points: 454
Post Options Post Options   Thanks (0) Thanks(0)   Quote zaboss Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2004 at 10:18am

The 3,3 is the cursor position, this part it's OK.

Are you sure that the dbdate field is set as a DATE field in Access? If it is, perhaps it's the single quotes. I think Access works without them.

Cristian Banu
Soft 4 web
Back to Top
stevem2003 View Drop Down
Newbie
Newbie
Avatar

Joined: 07 November 2003
Location: United Kingdom
Status: Offline
Points: 24
Post Options Post Options   Thanks (0) Thanks(0)   Quote stevem2003 Quote  Post ReplyReply Direct Link To This Post Posted: 14 April 2004 at 10:22am

Thanks Zaboss you are right.

Thanks to everybody

Back to Top
 Post Reply Post Reply Page  12>

Forum Jump Forum Permissions View Drop Down

Forum Software by Web Wiz Forums® version 12.08
Copyright ©2001-2026 Web Wiz Ltd.


Become a Fan on Facebook Follow us on X Connect with us on LinkedIn Web Wiz Blogs
About Web Wiz | Contact Web Wiz | Terms & Conditions | Cookies | Privacy Notice

Web Wiz is the trading name of Web Wiz Ltd. Company registration No. 05977755. Registered in England and Wales.
Registered office: Web Wiz Ltd, Unit 18, The Glenmore Centre, Fancy Road, Poole, Dorset, BH12 4FB, UK.

Prices exclude VAT at 20% unless otherwise stated. VAT No. GB988999105 - $, € prices shown as a guideline only.

Copyright ©2001-2026 Web Wiz Ltd. All rights reserved.