473,943 Members | 1,583 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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_dat e) VALUES (" & "'" & ucase(query_det ails) & "'" & ",1," &
date() & ")"

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

old_search_coun t = rs1("search_num ber")
new_search_coun t = old_search_coun t + 1
rs1("search_num ber") = new_search_coun t
rs1("last_searc h_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 1375
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_coun t = rs1("search_num ber")
new_search_coun t = old_search_coun t + 1
rs1("search_num ber") = new_search_coun t
rs1("last_searc h_date") = date()
rs1.update
Ugh! How about:

conn.execute "UPDATE Search_Stats SET search_number = search_number + 1,
last_search_dat e = GETDATE() WHERE Search_Details = '" & query_details &
"'", , 129
strSQL = "INSERT INTO SEARCH_STATS
(query_details, search_number, last_search_dat e)
VALUES (" & "'" & ucase(query_det ails) & "'"
& ",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
12409
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 the earliest date in another table where the linking fields values are equal. I set up a query with the two tables, made sure the common fields were linked, set the query as an "update" query, placed the field and table I want to update in the...
6
4704
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 be great! Thanks, Greg
0
3333
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 encountering the "run-time error 3061" issue, but I'm not sure how to go about correcting the SQL. My hunch is that I have not properly constructed things to identify a date field, but I don't know how to correct this issue. In addition to not...
6
2475
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) <DateAdd("d",8-Weekday((Now()-7),2),(Now()-7))) AND ((tblCalendar.Weekday)=1)) ; tblCalendar is a table of consecutive dates from 1998 thru 2020. It has proven useful in many applications. CalendarDay is the date. The code above
3
1543
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 processes. The Data in Network Solutions' WHOIS database is provided by Network Solutions for information purposes only, and to assist persons in obtaining information about or related to a domain name registration record. Network Solutions does not...
8
3371
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 out to the "archive" table when they leave, by pushing the "check-out" button. I see the steps as follows: 1. When the check-out button is pressed, the computer should automatically add the current date into the "date checked-out" field. ...
1
4133
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 standards for each area and an effective date of the standard. Any production numbers before the effectivity date will use the older standard and any on or after the date will use the newer standard. My problem is how to write a formula in a query that...
5
2979
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 Forms and Family and the associate table is called Forms_Family. Forms_Family have fields "dateSent" and "dateReceived". The Family table has a field called
13
3076
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
2574
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 - 20/6/07 Certificate - yes What I want to create is a renewal date for this training, there are
0
10136
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
11535
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
11126
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
9865
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
8220
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 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 a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6088
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4911
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
4510
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
3512
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.