473,395 Members | 1,870 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,395 software developers and data experts.

Access SQL to ASP SQL not working ... need help please

Hi,

I have taken some SQL from MS Access and got it working.
I have since updated the SQL in Access but cannot get the additional
part working in ASP.

The working SQL I have in asp is:-

strQuery = strQuery & " HAVING ((OrderQuantity-Sum(QtyShipped)>=0) AND
(OrderLines.SelectAll=-1) AND (PCBForecast.HeldMarker='Scheduled'))"

I need to add the following but keep getting errors saying my SQL is
incorrect.

This is the additional part which should also be on this line:-

AND ((PCBForecast.ShipETA) Between Now() And #12/30/3000#))"

or another variant I require

AND ((PCBForecast.ShipETA)=#12/31/3000#))"

What is the correct way to write both of these, as I cannot get either
to work in asp, yet they work in Access.

Apprecaite your advise

Thanks

David

Sep 28 '06 #1
4 1525

"David" <da*********@scene-double.co.ukwrote in message
news:11**********************@e3g2000cwe.googlegro ups.com...
Hi,

I have taken some SQL from MS Access and got it working.
I have since updated the SQL in Access but cannot get the additional
part working in ASP.

The working SQL I have in asp is:-

strQuery = strQuery & " HAVING ((OrderQuantity-Sum(QtyShipped)>=0) AND
(OrderLines.SelectAll=-1) AND (PCBForecast.HeldMarker='Scheduled'))"

I need to add the following but keep getting errors saying my SQL is
incorrect.

This is the additional part which should also be on this line:-

AND ((PCBForecast.ShipETA) Between Now() And #12/30/3000#))"

or another variant I require

AND ((PCBForecast.ShipETA)=#12/31/3000#))"

What is the correct way to write both of these, as I cannot get either
to work in asp, yet they work in Access.

Apprecaite your advise
The first thing you should do when ever you have a problem like this is to
check the SQL that is actually being executed.

Response.Write strQuery
Response.End

Just before you would normally exectute it. Check that the SQL is what you
expect it to be.

Another useful piece of advise would be specific! "I cannot get either to
work" tells us nothing.

Did it ignore your changes? Produce the wrong results?
Generate an error? If so what did it say? I dunno but it might be a clue
:P
There is a space before the AND right?
Thanks

David

Sep 28 '06 #2
David wrote:
Hi,

I have taken some SQL from MS Access and got it working.
I have since updated the SQL in Access but cannot get the additional
part working in ASP.

The working SQL I have in asp is:-

strQuery = strQuery & " HAVING ((OrderQuantity-Sum(QtyShipped)>=0) AND
(OrderLines.SelectAll=-1) AND (PCBForecast.HeldMarker='Scheduled'))"

I need to add the following but keep getting errors saying my SQL is
incorrect.

This is the additional part which should also be on this line:-

AND ((PCBForecast.ShipETA) Between Now() And #12/30/3000#))"

or another variant I require

AND ((PCBForecast.ShipETA)=#12/31/3000#))"

What is the correct way to write both of these, as I cannot get either
to work in asp, yet they work in Access.
Two things:
1. Datetime literals in SQL Server are delimited by quotes ('), not
hashmarks (#).
2. There are no VBA functions such as Now() available in SQL Server. The
variant of sql used by SQL Server is called Transact-SQL (sometimes
called T-SQL for short). Transact-SQL has builtin functions for doing
many of the things VBA functions are used for in Jet. GETDATE() is the
T-SQL equivalent to Now().

You may want to have a look at this article:
http://www.aspfaq.com/show.asp?id=2214
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Sep 28 '06 #3

"Bob Barrows [MVP]" <re******@NOyahoo.SPAMcomwrote in message
news:uh**************@TK2MSFTNGP06.phx.gbl...
David wrote:
Hi,

I have taken some SQL from MS Access and got it working.
I have since updated the SQL in Access but cannot get the additional
part working in ASP.

The working SQL I have in asp is:-

strQuery = strQuery & " HAVING ((OrderQuantity-Sum(QtyShipped)>=0) AND
(OrderLines.SelectAll=-1) AND (PCBForecast.HeldMarker='Scheduled'))"

I need to add the following but keep getting errors saying my SQL is
incorrect.

This is the additional part which should also be on this line:-

AND ((PCBForecast.ShipETA) Between Now() And #12/30/3000#))"

or another variant I require

AND ((PCBForecast.ShipETA)=#12/31/3000#))"

What is the correct way to write both of these, as I cannot get either
to work in asp, yet they work in Access.
Two things:
1. Datetime literals in SQL Server are delimited by quotes ('), not
hashmarks (#).
2. There are no VBA functions such as Now() available in SQL Server. The
variant of sql used by SQL Server is called Transact-SQL (sometimes
called T-SQL for short). Transact-SQL has builtin functions for doing
many of the things VBA functions are used for in Jet. GETDATE() is the
T-SQL equivalent to Now().

You may want to have a look at this article:
http://www.aspfaq.com/show.asp?id=2214
Did I miss something that points to SQL Server?
>
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.


Sep 28 '06 #4
Anthony Jones wrote:
>
Did I miss something that points to SQL Server?
Nope. I misread it.

To the OP:
Show us the vbscript code that is failing. Better yet, read these:

See here for a better, more secure way to execute your queries by using
parameter markers:
http://groups-beta.google.com/group/...e36562fee7804e

Personally, I prefer using stored procedures, or saved parameter queries
as
they are known in Access:

Access:
http://www.google.com/groups?hl=en&l...TNGP12.phx.gbl

http://groups.google.com/groups?hl=e...tngp13.phx.gbl

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
Sep 28 '06 #5

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

Similar topics

15
by: Cheryl Langdon | last post by:
Hello everyone, This is my first attempt at getting help in this manner. Please forgive me if this is an inappropriate request. I suddenly find myself in urgent need of instruction on how to...
17
by: Mell via AccessMonster.com | last post by:
Is there a way to find out where an application was created from? i.e. - work or home i.e. - if application sits on a (work) server/network, the IT people know the application is sitting...
4
by: alexandre.brisebois | last post by:
Hi, I am using access 2003, I would like to know if there is an option to reorganize the tables in a maner that is readable, as we can do in sql sever 2000 or 2005. I have been given a database...
2
by: Frav | last post by:
The Reps team have been experiencing that Access 2002 unexpectedly quits while working and also lots of Corruption Failures and "Record lock can not update" messages since the upgrade from...
4
by: Nick Gilbert | last post by:
Hi, Is it possible to access the Session of an arbitary user from an aspx page? On an e-commerce site, I am notified of payment success via a callback from the payment server to an ASPX page...
9
by: JT | last post by:
Here is the overall structure I will be referring to: End-program ProvideWorkFlow.dll Forms and methods that properly manipulate calls to methods in AccessUtils AccessUtils (a web service)...
7
by: =?Utf-8?B?RG91Z2llIEJyb3du?= | last post by:
Hi I've written custom configuration section (inherits from System.Configuration.ConfigurationSection) to simplify the contents of the config file and to make life easier when accessing them in...
2
by: bandkindy | last post by:
To preface, I am pretty green on the whole sql thing, but am learning quickly so please bear with me. I have an excel file that is copied to 5 users directories so they have their own working...
1
by: bandkindy | last post by:
To preface, I am pretty green on the whole sql thing, but am learning quickly so please bear with me. I have an excel file that is copied to 5 users directories so they have their own working...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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,...
0
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
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,...

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.