473,385 Members | 1,593 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

another date query

this is really bugging me as I can't see why this is happening.

I have a page which runs as the reult of a search, records details of the
search, it goes a bit like this.

get dearch criteria and search datebase.

if no data is found then create a record for that search, including the
search query, the search count (set to 1), and the search date.

strSQL = "INSERT INTO SEARCH_STATS (query_details, search_number,
last_search_date) VALUES (" & "'" & ucase(query_details) & "'" & ",1," &
date() & ")"

if the search data is found then increase the search count by one and amend
the last search date.

old_search_count = rs1("search_number")
new_search_count = old_search_count + 1
rs1("search_number") = new_search_count
rs1("last_search_date") = date()
rs1.update
now, if no search data is found then when the search record is created the
date that gets inserted is all wrong (it looks more like a time format)

if the search data is found the date that gets updated becomes correct.

what I can't figure out is how two dates() on the same page can give
different results???

Jul 19 '05 #1
2 1349
BTW, your table is going to get quite large, assuming a decent amount of
activity. I used to maintain information about all searches at aspfaq.com,
now I've resorted to only tracking searches that get 0 results. (That helps
me narrow down the list of future articles.)

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 19 '05 #2
> old_search_count = rs1("search_number")
new_search_count = old_search_count + 1
rs1("search_number") = new_search_count
rs1("last_search_date") = date()
rs1.update
Ugh! How about:

conn.execute "UPDATE Search_Stats SET search_number = search_number + 1,
last_search_date = GETDATE() WHERE Search_Details = '" & query_details &
"'", , 129
strSQL = "INSERT INTO SEARCH_STATS
(query_details, search_number, last_search_date)
VALUES (" & "'" & ucase(query_details) & "'"
& ",1," & date() & ")"


You forgot to put delimiters around your date, so the database sees
06/01/2004 as a number (6 divided by 1 divided by 2004). But more to the
point, why do you think you need to pass a date from ASP? The database is
certainly capable of determining the date, without opening your application
up to weird formatting issues like the above, or misinterpreted regional
settings (dd/mm/yyyy vs. mm/dd/yyyy, etc).

strSQL = "INSERT ... ,1, GETDATE())"

(If you are using Access, you will need to change GETDATE() to Date(). Once
again, it is always useful to tell us a little bit about the software you're
using, so we don't have to guess and/or make assumptions.)

--
http://www.aspfaq.com/
(Reverse address to reply.)
Jul 19 '05 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: Wilder | last post by:
I'm trying to update a field in one table with the minimum values of the field in another table. The two tables are linked via a common field. I want to populate a date field in one table with...
6
by: Greg | last post by:
I am trying to change the value of one field in my query based on the value in another. If Field 1 had the text "ONACCNT" then in Feild 2 I want the date to change to today's date. Any help would...
0
by: Miranda Evans | last post by:
I noticed several postings about issues related to "run-time error 3061", and I observed that the solutions to these issues appear to involve correcting something within the SQL code. I'm...
6
by: Bill R via AccessMonster.com | last post by:
I have a query: SELECT tblCalendar.CalendarDay AS LastSunday FROM tblCalendar WHERE (((tblCalendar.CalendarDay)>=(Now()-7) And (tblCalendar.CalendarDay)...
3
by: Vjay77 | last post by:
As a result from who is I am getting this: > > NOTICE AND TERMS OF USE: You are not authorized to access or query our WHOIS database through the use of high-volume, automated, electronic...
8
by: daD | last post by:
I'm trying to write a small database that tracks people coming and going from a small campground. I need to have the current guests in the "current" table" and then have the ability to check them...
1
by: Beeker | last post by:
I have a table called 'RawData' that collects production data. We run a report on this data everyday to see the performance of each employee. I have another table called 'tblStandards' with...
5
by: Rex | last post by:
Hi, I want to change a value in one table depending on the value(s) in another table. I am trying to achieve this in a form. to elaborate I have a many-to-many relationship between tables...
13
by: imnewtoaccess | last post by:
Hi, I am getting errors while inserting records in one table from another. These are the structures of two tables : file51tm_new RecordType Text
2
by: dympna | last post by:
Hi can anyone suggest a fix for this... as I am a novice in access. I have created a training table with the following fields Employee Name - joe Training Received - Fork lift Date Received...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.