473,749 Members | 2,384 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Queries from Access

Hello all

I am having a odd problem, I have a page that lists users (GridView), this
list links through to another page when you click on the name. The second
page lists all phone calls they received during the previous month
(GridView). I have done this by a Querystring passing SupportId from the
first to the second page.

The second page GridView data source is based on an SQL statement:
"WHERE (supportid = ?) AND
((Right(Left([datetaken],8),5))=Right(D ateAdd("m",-1,Date()),5))"

the [datetaken] field is the date and time the call was received.

This works fine on my computer running it under a local host. However, when
I copy it to my IIS server V6, it does not show any records on the second
page.

Everything else works fine, the list on the first page works ok, even the
second page loads fine but it says No Calls.

Does anyone have a clue why? I have tried almost everything I can think off
but nothing makes a difference.
Many thanks in advance

James
Mar 17 '07
20 1072
Hi

I set up a linked connection to it and it worked fine. the lock file
appeared as well.

If I open up the database the lock file appears and the query shows all the
records it should.

"Mark Rae" wrote:
"James" <Ja***@discussi ons.microsoft.c omwrote in message
news:07******** *************** ***********@mic rosoft.com...
Yes they are both accessing the same database, when I renamed the database
they both had errors saying they could not find it.

I also just deleted one of the names from the database and it dissapeard
from the first page where it lists the names in the table so it is.

I can't think why this is happening

Me neither...

Are you able to query this database through any other means...? E.g. a full
copy of Access, or something like Excel which can query Jet databases (Get
External Data...)

If so, what happens if you run the query manually...?
Mar 20 '07 #11
"James" <Ja***@discussi ons.microsoft.c omwrote in message
news:0A******** *************** ***********@mic rosoft.com...
I set up a linked connection to it and it worked fine. the lock file
appeared as well.

If I open up the database the lock file appears and the query shows all
the
records it should.
In which case, you need to apply the Sherlock Holmes logic which says that,
once you have eliminated the impossible, whatever is left (however
improbable) must be the answer...

If you have a web page which should be querying a Jet database but, when it
runs, the corresponding locking database doesn't appear and the Last
Accessed date of the Jet database is not updated, then at that precise
moment it isn't querying the database - it just can't be, however improbable
you find this to be...

If you rename the database immediately prior to accessing the page in
question, what happens...?
Mar 20 '07 #12
Hi

Well nothing happens, but if i click refresh it has an errror message. I
have custom errors off but I am guessing it is that it cannot find the
database.

The first page that works ok also has the error message so they must be both
accessing the same database.

"Mark Rae" wrote:
"James" <Ja***@discussi ons.microsoft.c omwrote in message
news:0A******** *************** ***********@mic rosoft.com...
I set up a linked connection to it and it worked fine. the lock file
appeared as well.

If I open up the database the lock file appears and the query shows all
the
records it should.

In which case, you need to apply the Sherlock Holmes logic which says that,
once you have eliminated the impossible, whatever is left (however
improbable) must be the answer...

If you have a web page which should be querying a Jet database but, when it
runs, the corresponding locking database doesn't appear and the Last
Accessed date of the Jet database is not updated, then at that precise
moment it isn't querying the database - it just can't be, however improbable
you find this to be...

If you rename the database immediately prior to accessing the page in
question, what happens...?
Mar 20 '07 #13
"James" <Ja***@discussi ons.microsoft.c omwrote in message
news:CB******** *************** ***********@mic rosoft.com...
Well nothing happens,
There's your problem, then!
but if i click refresh it has an errror message. I have custom errors off
but I am
guessing it is that it cannot find the database.
Probably, but only you can tell... :-)
The first page that works ok also has the error message so they must be
both
accessing the same database.
No - they may both be configured to access the same database, but something
in your code is bypassing the database query, otherwise you'd get an
error...
Mar 20 '07 #14
I would suggest to use a dummy criteria and to display
((Right(Left([datetaken],8),5)) and Right(DateAdd(" m",-1,Date()),5)) to see
if this the value you expect.

In particular keep in mind that a date to string conversion is dependent on
the national language you are using. Either make sure you use the language
you need. My personal preference would be to compare date values
(datetaken>=Dat eAdd("m",-1,Date() or something similar))

---
Patrice

"James" <Ja***@discussi ons.microsoft.c oma écrit dans le message de news:
20************* *************** **...icrosof t.com...
Hello all

I am having a odd problem, I have a page that lists users (GridView), this
list links through to another page when you click on the name. The second
page lists all phone calls they received during the previous month
(GridView). I have done this by a Querystring passing SupportId from the
first to the second page.

The second page GridView data source is based on an SQL statement:
"WHERE (supportid = ?) AND
((Right(Left([datetaken],8),5))=Right(D ateAdd("m",-1,Date()),5))"

the [datetaken] field is the date and time the call was received.

This works fine on my computer running it under a local host. However,
when
I copy it to my IIS server V6, it does not show any records on the second
page.

Everything else works fine, the list on the first page works ok, even the
second page loads fine but it says No Calls.

Does anyone have a clue why? I have tried almost everything I can think
off
but nothing makes a difference.
Many thanks in advance

James

Mar 20 '07 #15
"Patrice" <http://www.chez.com/scribe/wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>I would suggest to use a dummy criteria and to display
((Right(Left ([datetaken],8),5)) and Right(DateAdd(" m",-1,Date()),5)) to see
if this the value you expect.
We've already established that the database is not even being queried at
this point, so changing the criterion won't help at all...
Mar 20 '07 #16
Hi

Ok tried editing the datasource, this is the full SQL statement for the
datagrid:

SELECT supportmember.s upportid, supportmember.d atetaken, icb.number,
icb.firstname, icb.lastname, Right(Left([datetaken],8),5) AS Expr1
FROM supportmember INNER JOIN icb ON supportmember.m emid = icb.memid
WHERE ((supportid = ?) AND (supportmember. datetaken Like "*/07*"))
ORDER BY supportmember.d atetaken DESC

Now if I remove
AND (supportmember. datetaken Like "*/07*")
It works fine by bringing up the list with the matching supportid.

So it must be that addition about the datetaken that is causing it to find
nothing. I have tried things like *07* or whatever just to try and get it to
find something in that field. I know the data is there as I can open the
query in access using the same SQL code (but putting in a supportid manualy)
and it shows a list.

It is accessing the correct database as I amended the data and put some test
figures in and they appeared properly on the first page, and the second one
without the Datetaken bit in the WHERE clause.

Am I doing the AND bit wrong? I have run out of ideas :)

Thanks for your help so far though its been great.

James
"Mark Rae" wrote:
"Patrice" <http://www.chez.com/scribe/wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
I would suggest to use a dummy criteria and to display
((Right(Left([datetaken],8),5)) and Right(DateAdd(" m",-1,Date()),5)) to see
if this the value you expect.

We've already established that the database is not even being queried at
this point, so changing the criterion won't help at all...
Mar 20 '07 #17
Hello again,

Ok it must be something wrong with my AND statement I have just tried
amending it to:

SELECT supportmember.s upportid, supportmember.d atetaken, icb.number,
icb.firstname, icb.lastname, Right(Left([datetaken],8),5) AS Expr1
FROM supportmember INNER JOIN icb ON supportmember.m emid = icb.memid
WHERE ((supportid = ?) AND (icb.lastname Like "*"))
ORDER BY supportmember.d atetaken DESC

So it should show all records with the matching supportid (usualy about 40
records) as the Lastname will always match that requirement. But it still
shows no records.

"James" wrote:
Hi

Ok tried editing the datasource, this is the full SQL statement for the
datagrid:

SELECT supportmember.s upportid, supportmember.d atetaken, icb.number,
icb.firstname, icb.lastname, Right(Left([datetaken],8),5) AS Expr1
FROM supportmember INNER JOIN icb ON supportmember.m emid = icb.memid
WHERE ((supportid = ?) AND (supportmember. datetaken Like "*/07*"))
ORDER BY supportmember.d atetaken DESC

Now if I remove
AND (supportmember. datetaken Like "*/07*")
It works fine by bringing up the list with the matching supportid.

So it must be that addition about the datetaken that is causing it to find
nothing. I have tried things like *07* or whatever just to try and get it to
find something in that field. I know the data is there as I can open the
query in access using the same SQL code (but putting in a supportid manualy)
and it shows a list.

It is accessing the correct database as I amended the data and put some test
figures in and they appeared properly on the first page, and the second one
without the Datetaken bit in the WHERE clause.

Am I doing the AND bit wrong? I have run out of ideas :)

Thanks for your help so far though its been great.

James
"Mark Rae" wrote:
"Patrice" <http://www.chez.com/scribe/wrote in message
news:%2******** ********@TK2MSF TNGP05.phx.gbl. ..
>I would suggest to use a dummy criteria and to display
>((Right(Left ([datetaken],8),5)) and Right(DateAdd(" m",-1,Date()),5)) to see
>if this the value you expect.
We've already established that the database is not even being queried at
this point, so changing the criterion won't help at all...

Mar 20 '07 #18
Hello

I've Done it!!!!! The problem was that UK and USA dates are different, so I
had to add code to format both dates into UK before comparing them. My
computer it worked fine as its UK same as data, but ASP.Net is obviously USA
so when on the server it was looking for a day instead of a month.

Final code is:

SELECT supportmember.s upportid, supportmember.d atetaken, icb.[number],
icb.firstname, icb.lastname, RIGHT (LEFT (supportmember. datetaken, 8), 5) AS
Expr1 FROM (supportmember INNER JOIN icb ON supportmember.m emid = icb.memid)
WHERE (supportmember. supportid = ?) AND
((Right(Left(Fo rmat([datetaken],"dd/mm/yy"),8),5))=Rig ht(Format(DateA dd("m",-1,Date()),"dd/mm/yy"),5)) ORDER BY supportmember.d atetaken DESC

Wow this one confused me for days.

Many thanks for your help, keep up the good work.

Cheers
James

"James" wrote:
Hello all

I am having a odd problem, I have a page that lists users (GridView), this
list links through to another page when you click on the name. The second
page lists all phone calls they received during the previous month
(GridView). I have done this by a Querystring passing SupportId from the
first to the second page.

The second page GridView data source is based on an SQL statement:
"WHERE (supportid = ?) AND
((Right(Left([datetaken],8),5))=Right(D ateAdd("m",-1,Date()),5))"

the [datetaken] field is the date and time the call was received.

This works fine on my computer running it under a local host. However, when
I copy it to my IIS server V6, it does not show any records on the second
page.

Everything else works fine, the list on the first page works ok, even the
second page loads fine but it says No Calls.

Does anyone have a clue why? I have tried almost everything I can think off
but nothing makes a difference.
Many thanks in advance

James
Mar 20 '07 #19
"James" <Ja***@discussi ons.microsoft.c omwrote in message
news:50******** *************** ***********@mic rosoft.com...
I've Done it!!!!! The problem was that UK and USA dates are different, so
I
had to add code to format both dates into UK before comparing them. My
computer it worked fine as its UK same as data, but ASP.Net is obviously
USA
so when on the server it was looking for a day instead of a month.

Wow this one confused me for days.

Many thanks for your help, keep up the good work.
Hurrah! Well done for finally figuring it out... :-)
Mar 20 '07 #20

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

Similar topics

6
6782
by: Andreas Lauffer | last post by:
I changed from Access97 to AccessXP and I have immense performance problems. Details: - Access XP MDB with Jet 4.0 ( no ADP-Project ) - Linked Tables to SQL-Server 2000 over ODBC I used the SQL Profile to watch the T-SQL-Command which Access ( who creates the commands?) creates and noticed:
4
2022
by: dschl | last post by:
Hi, I'm converting an Access 2000 database to Sql Server and must be missing something obvious. Using the Import utility in Sql Server, the Access queries seem to get executed and the resultant data imported as tables. Oops! Using the Upsize lizard in Access 2003, the queries aren't even in the selection list of "tables" to upsize. It looks like the Upsize wizard
4
1860
by: R | last post by:
Hi When an Access query is run against an ODBC table, is it possible in any way to tell what is passed to the server? I have a remote Sybase database linked into Access and the bandwidth is terrible, so I need the processing to be done purely on the server. Some simple queries run quickly, so the processing is being done on the server. Some complex queries with IIf statements etc. are definately not being converted to Sybase compatible...
5
4042
by: Jerry Hull | last post by:
I'm working with a database developed by an untrained person over several years - and on a network that has recently been upgraded with a new server installed and MS office upgraded from 2K (I think - it might have been XP) to 2003. The database is impressive, both in what it does and the obtuse and inconsistent ways it works. There are several hundred queries, for example, with no indication of where they are used or if they are in fact...
5
6324
by: marshmallowww | last post by:
I have an Access 2000 mde application which uses ADO and pass through queries to communicate with SQL Server 7, 2000 or 2005. Some of my customers, especially those with SQL Server 2005, have had pass-through queries fail due to intermittent connection failures. I can easily restablish a connection for ADO. My problem is with pass-through queries.
0
8996
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
9566
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...
1
9333
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
1
6800
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
6078
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4608
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
3319
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
2791
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2217
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.