473,765 Members | 2,047 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.Sel ectAll=-1) AND (PCBForecast.He ldMarker='Sched uled'))"

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.S hipETA) Between Now() And #12/30/3000#))"

or another variant I require

AND ((PCBForecast.S hipETA)=#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 1540

"David" <da*********@sc ene-double.co.ukwro te in message
news:11******** **************@ e3g2000cwe.goog legroups.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.Sel ectAll=-1) AND (PCBForecast.He ldMarker='Sched uled'))"

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.S hipETA) Between Now() And #12/30/3000#))"

or another variant I require

AND ((PCBForecast.S hipETA)=#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.Sel ectAll=-1) AND (PCBForecast.He ldMarker='Sched uled'))"

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.S hipETA) Between Now() And #12/30/3000#))"

or another variant I require

AND ((PCBForecast.S hipETA)=#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******@NOyah oo.SPAMcomwrote in message
news:uh******** ******@TK2MSFTN GP06.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.Sel ectAll=-1) AND (PCBForecast.He ldMarker='Sched uled'))"

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.S hipETA) Between Now() And #12/30/3000#))"

or another variant I require

AND ((PCBForecast.S hipETA)=#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
4641
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 communicate with a MySQL database table on a web server, from inside of my company's Access-VBA application. I know VBA pretty well but have never before needed to do this HTTP/XML/MySQL type functions.
17
4416
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 there, but is there a way they can find out if that application was put there from a CD or email or created at work? Hint: It's not on a client/server database, just native jet database mdb created on Access 2003 (default 2000)...
4
6408
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 to look a and I am loosing tremendious amounts of time trying to organize it so that I could view it. Regards, Alexandre Brisebois
2
6255
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 Windows 2000 and Access 200 to Windows XP and Access 2002 (XP) was done. Now, they are working and at anytime in anywhere of the application access unexpectedly quits with no error messages and the info that was being entered
4
3744
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 on my system. I would like to be able to access the session of the user that submitted the order, and clear their basket. I don't really want to store their session in the database just to facilitate this.
9
2165
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) Hide.dll methods and data I want to remain hidden I have a DLL, Hide.dll, that contains methods that I want to handle for
7
10828
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 code. The configuration section is contained within the exe (it's a simple test case!) and everything works well debugging within the IDE or if the application is deployed on a drive or share that has been granted full trust. For the share the...
2
1832
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 copy. This file is populated by the user. There is a macro that saves the file and names it based on specific data the user enters (first last name). I have that working fine. I also have created a macro that dumps the data to an Access 2007 db named...
1
1542
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 copy. This file is populated by the user. There is a macro that saves the file and names it based on specific data the user enters (first last name). I have that working fine. I also have created a macro that dumps the data to an Access 2007 db named...
0
9568
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
9404
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10164
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
9959
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,...
0
9835
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8833
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
7379
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
6649
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
5277
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...

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.