SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
 
 
User Name:
Password:
Remember me
Go Back   ASP Free ForumsDatabaseSQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread ASP Free Forums Sponsor:
  #1  
Old March 31st, 2004, 11:22 AM
MTFLYNN MTFLYNN is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 MTFLYNN User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Angry Sql Between Using Dates

Guys, I really need your help.

I am running a query from an ASP page as shown below

"SELECT * FROM Appointments WHERE GPID = '" & this_GP & "' AND Date BETWEEN '" & start_date & "' AND '" & End_date & "' "

Now it does retrieve the information held between the dates on the database (ACCESS) although my problem is this

If I am querying between 31/3/04 and 6/4/04 it retrieves all the records up to the 31rst of the 4th ! ! The data is held on the database in dd/mm/yy format and I have set the Server.LCID on my page to dd/mm/yy. I have even tried changing the ' for # in the sql statement.

Please help - its part of my final year project for uni and I am

Thanks
Mark

Reply With Quote
  #2  
Old March 31st, 2004, 05:44 PM
sbaxter sbaxter is offline
Moderator: Access, SQL
ASP Free God (5000 - 5499 posts)
 
Join Date: Oct 2003
Posts: 5,126 sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level)sbaxter User rank is Corporal (100 - 500 Reputation Level) 
Time spent in forums: 4 Days 1 h 2 m 51 sec
Reputation Power: 13
In queried Access can onlly handle dates in mm/dd/yy format. otherwise it gets confused. There is some knowledgebase that I read a week or two about it, but I can't remember which one.

If I remember correctly you don't want single quotes around your variable either (makes it think it is a string)

S_

Reply With Quote
  #3  
Old April 2nd, 2004, 09:24 AM
MTFLYNN MTFLYNN is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Mar 2004
Posts: 3 MTFLYNN User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks Sbaxter for the help but I eventually had to give in to microsoft since Access Queries its tables using mm/dd/yy format.

All sorted now though !
Thanks Again
MT.

Reply With Quote
  #4  
Old April 7th, 2004, 04:19 PM
aiyong04 aiyong04 is offline
Registered User
ASP Free Newbie (0 - 499 posts)
 
Join Date: Apr 2004
Posts: 3 aiyong04 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Question Date problem

MTFLYNN,

Have you solve your problem??

My problem is almost same as yours.

tempLastDate = DateValue(Session("LastLoginDate"))
SQL = "SELECT count(*) as DateMatch FROM tblLogin WHERE DateLogin > '"&tempLastDate&"'"
Set rsNotice = connNotice.Execute(SQL) //line 19

//the value of session("lastLoginDate") is 04/04/2004, dd/mm/yyyy, data type is date/time in microsoft access.
//connNotice is just a object connection
//tblLogin is a table, DateLogin contains date value which in dd/mm/yyyy format.

Error Type:
Microsoft OLE DB Provider for ODBC Drivers (0x80040E07)
[Microsoft][ODBC Microsoft Access Driver] Data type mismatch in criteria expression.
/project/Code/Home.asp, line 19

Do you have any clue to solve this? if is due with the format, can you tell me how to convert the format in asp?

regards,
aiyong

Reply With Quote
  #5  
Old April 7th, 2004, 04:23 PM
Memnoch's Avatar
Memnoch Memnoch is offline
Unholy Moderator
Click here for more information.
 
Join Date: Oct 2003
Location: In hell, where did you think?
Posts: 11,781 Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level)Memnoch User rank is Lieutenant Colonel (40000 - 50000 Reputation Level) 
Time spent in forums: 3 Weeks 5 Days 8 h 45 m 55 sec
Reputation Power: 470
try this
Code:
SQL = "SELECT count(*) as DateMatch FROM tblLogin WHERE DateLogin > #" & tempLastDate & "#"

Reply With Quote
Reply

Viewing: ASP Free ForumsDatabaseSQL Development > Sql Between Using Dates


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 1 hosted by Hostway
Stay green...Green IT