Queries and Now()

C

Craig

Hi

Using Access 2007.

I have a database in mdb format that records the information of customer
sales on a web site. In the OrderDate field I am using Now() to record the
date and time the order is placed.

I also have a query which displays only currently open orders.

When I view either the table or query data locally within Access the
date/time information of each order displays correctly.

Likewise, when I view the table data online via an ASP VB web page, the
date/time information of each order displays correctly

However, when I view query data online via an ASP VB web page, the date/time
information of each order displays as the date/time of the most recent
order.

Why is this???

And how can I get the correct data to display? (I realize that I can use the
table data directly by filtering the data in ASP, but would rather use the
query.)

(On a similar note, I've noticed that a query that is sorted by a randomly
generated number always sorts records randomly within Access but the records
always appear in the same order when the query is viewed online through an
ASP VB page.)

Thanks,

Craig
 
A

Amy Blankenship

Craig said:
Hi

Using Access 2007.

I have a database in mdb format that records the information of customer
sales on a web site. In the OrderDate field I am using Now() to record
the date and time the order is placed.

I also have a query which displays only currently open orders.

When I view either the table or query data locally within Access the
date/time information of each order displays correctly.

Likewise, when I view the table data online via an ASP VB web page, the
date/time information of each order displays correctly

However, when I view query data online via an ASP VB web page, the
date/time information of each order displays as the date/time of the most
recent order.

Why is this???

What is the code?
 
C

Craig

What code? In the ASP page?

It's Now() in the Access table for the OrderDate field.
 
M

Michel Walsh

I suspect your ASP implementation optimizes something it should not. It may
also be version dependant, such as ASP.Net 3.5 or previous versions. Sure,
that sounds like I try to send the problem to ASP, but if the query behaves
correctly within Access... Can you try to get the data from, say, Excel, or
from MS SQL Server, or from a dataview tool from C#, to see if it get as
Access, or as your ASP implementation shows it, letting Excel (MS SLQ
Server, C#) determines who is the source of the problem, kind of ... :)



Vanderghast, Access MVP
 
C

Craig

Could you say that again in English? ;-)


Michel Walsh said:
I suspect your ASP implementation optimizes something it should not. It may
also be version dependant, such as ASP.Net 3.5 or previous versions. Sure,
that sounds like I try to send the problem to ASP, but if the query behaves
correctly within Access... Can you try to get the data from, say, Excel, or
from MS SQL Server, or from a dataview tool from C#, to see if it get as
Access, or as your ASP implementation shows it, letting Excel (MS SLQ
Server, C#) determines who is the source of the problem, kind of ... :)



Vanderghast, Access MVP
 
A

Amy Blankenship

Craig said:
What code? In the ASP page?

It's Now() in the Access table for the OrderDate field.

By the time you're running your query to display the data, it should already
have been stored. So, yes, your ASP code.
 
A

Amy Blankenship

Craig said:
Could you say that again in English? ;-)

I think what he is saying is that the problem is probably in your ASP code
and not the query. So probably in the loop where you think you've changed
what you're looking at, you're changing it for everything but the
misbehaving field. So maybe you store that field's value above the loop,
and you're always retrieving the same value.
 
M

Michel Walsh

Exactly, thanks. In addition, ASP settings themselves may possibly cache
some data it perceives as 'constant', avoiding a round trip to the server.
That is why I suggest to use another tool, to see the data, for yourself,
not to write your application, no, but to determine, hopefully, if the
problem is within Access, or with ASP. If the third tool shows data as in
Access, then the ASP code you use is probably the problem, not the Access
query that you use.



Vanderghast, Access MVP
 
A

Amy Blankenship

Craig said:
Could you put that a little more clearly, please?

If you post your ASP code, we can look at it and probably tell you exactly
where the problem is.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top