MS Access SQL> ASP SQL问题.... [英] MS Access SQL > ASP SQL problem....

查看:60
本文介绍了MS Access SQL> ASP SQL问题....的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述




我有以下代码,当我作为我的

ASP SQL的一部分运行时会返回错误....


strquery = strquery& " FROM(客户INNER JOIN订单ON

Customers.CustomerID = Orders.CustomerID)INNER JOIN(产品INNER

JOIN(OrderLines INNER JOIN StockMovements ON OrderLines.JobNumber =

StockMovements.JobNumber)ON(Products.ProductID =

OrderLines.ProductID)AND(Products.ProductID = OrderLines.ProductID))

ON订单.OrderID = OrderLines.OrderID"


我直接从MS Access Query SQL复制了这个。我将如何调整

此代码在ASP中工作?

感谢您的帮助

David

Hi,

I have the following code which returns an error when run as part of my
ASP SQL....

strquery = strquery & "FROM (Customers INNER JOIN Orders ON
Customers.CustomerID = Orders.CustomerID) INNER JOIN (Products INNER
JOIN (OrderLines INNER JOIN StockMovements ON OrderLines.JobNumber =
StockMovements.JobNumber) ON (Products.ProductID =
OrderLines.ProductID) AND (Products.ProductID = OrderLines.ProductID))
ON Orders.OrderID = OrderLines.OrderID"

I have copied this direct from MS Access Query SQL. How would I adapt
this code to work in ASP ?
Appreciate your help
David

推荐答案

da *** @ scene-double.co.uk 写道:


我有以下代码返回错误


什么错误?

作为我的ASP SQL的一部分运行....

strquery = strquery& " FROM(客户INNER JOIN订单ON
Customers.CustomerID = Orders.CustomerID)INNER JOIN(产品INNER
JOIN(OrderLines INNER JOIN StockMovements ON OrderLines.JobNumber =
StockMovements.JobNumber)ON (Products.ProductID =
OrderLines.ProductID)AND(Products.ProductID = OrderLines.ProductID))
ON Orders.OrderID = OrderLines.OrderID"

我直接复制了这个从MS Access Query SQL。我将如何调整此代码以在ASP中工作?
Hi,

I have the following code which returns an error
What error?
when run as part of
my ASP SQL....

strquery = strquery & "FROM (Customers INNER JOIN Orders ON
Customers.CustomerID = Orders.CustomerID) INNER JOIN (Products INNER
JOIN (OrderLines INNER JOIN StockMovements ON OrderLines.JobNumber =
StockMovements.JobNumber) ON (Products.ProductID =
OrderLines.ProductID) AND (Products.ProductID = OrderLines.ProductID))
ON Orders.OrderID = OrderLines.OrderID"

I have copied this direct from MS Access Query SQL. How would I adapt
this code to work in ASP ?



调试sql语句的唯一方法是知道它是什么。做


Response.Write strquery


查看你的vbscript代码生成了什么。如果它是正确的,你应该是

能够将它从浏览器窗口复制并粘贴到

访问查询生成器的SQL视图中并运行它而不进行修改(除非通配符)

参与其中)。


你最好直接执行保存的查询,而不是处理所有动态sql的
废话:
http://groups-beta.google.com/group/...d6889?oe=UTF-8


Bob Barrows


-

Microsoft MVP - ASP / ASP.NET

请回复新闻组。我的From

标题中列出的电子邮件帐户是我的垃圾邮件陷阱,因此我不经常检查它。通过发布到新闻组,您将获得更快的回复。


The only way to debug a sql statement is to know what it is. Do

Response.Write strquery

to see what your vbscript code has generated. If it is correct you should be
able to copy and paste it from the browser window into the SQL View of an
Access Query Builder and run it without modification (unless wildcards are
involved).

You would be better off executing the saved query directly instead of
dealing with all the dynamic sql nonsense:
http://groups-beta.google.com/group/...d6889?oe=UTF-8

Bob Barrows

--
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.


所有这些括号都会导致SQL解释器出现问题。你还需要在每次INNER JOIN之后需要一个ON ...你不能说INNER JOIN INNER JOIN ON

ON。 Gawd,Access教会一些坏习惯。试试这个:


来自客户c

INNER JOIN订单o

ON c.CustomerID = o.CustomerID

INNER JOIN OrderLines oL

ON oL.OrderID = oL.OrderID

INNER JOIN产品p

ON oL.ProductID = p .ProductID

INNER JOIN StockMovements s

ON oL.JobNumber = s.JobNumber


-
http://www.aspfaq.com/

(反向地址回复。)


< da *** @ scene-double.co.uk>在消息中写道

news:11 ******************** @ z14g2000cwz.googlegrou ps.com ...
All those parentheses are causing the SQL interpreter problems. You also
need an ON after each INNER JOIN... you can''t say INNER JOIN INNER JOIN ON
ON. Gawd, Access teaches some bad habits. Try this:

FROM Customers c
INNER JOIN Orders o
ON c.CustomerID = o.CustomerID
INNER JOIN OrderLines oL
ON oL.OrderID = oL.OrderID
INNER JOIN Products p
ON oL.ProductID = p.ProductID
INNER JOIN StockMovements s
ON oL.JobNumber = s.JobNumber

--
http://www.aspfaq.com/
(Reverse address to reply.)


<da***@scene-double.co.uk> wrote in message
news:11********************@z14g2000cwz.googlegrou ps.com...


我有以下代码在作为我的ASP SQL的一部分运行时返回错误....

strquery = strquery& " FROM(客户INNER JOIN订单ON
Customers.CustomerID = Orders.CustomerID)INNER JOIN(产品INNER
JOIN(OrderLines INNER JOIN StockMovements ON OrderLines.JobNumber =
StockMovements.JobNumber)ON (Products.ProductID =
OrderLines.ProductID)AND(Products.ProductID = OrderLines.ProductID))
ON Orders.OrderID = OrderLines.OrderID"

我直接复制了这个从MS Access Query SQL。我将如何调整此代码以在ASP中工作?

感谢您的帮助

David
Hi,

I have the following code which returns an error when run as part of my
ASP SQL....

strquery = strquery & "FROM (Customers INNER JOIN Orders ON
Customers.CustomerID = Orders.CustomerID) INNER JOIN (Products INNER
JOIN (OrderLines INNER JOIN StockMovements ON OrderLines.JobNumber =
StockMovements.JobNumber) ON (Products.ProductID =
OrderLines.ProductID) AND (Products.ProductID = OrderLines.ProductID))
ON Orders.OrderID = OrderLines.OrderID"

I have copied this direct from MS Access Query SQL. How would I adapt
this code to work in ASP ?
Appreciate your help
David


Bob,


很高兴再次收到您的回复。至少我知道我可以指望你

很有帮助。


我试过response.write ...真的没多大帮助。

我可以更容易地运行已经保存在

MS Access Back End中的查询,并将结果直接输出到ASP中。


我的查询名为RemainderStatusBBUK


我已经有一个包含文件用于连接数据库:


_______________________________________

strConnection =" driver =

{MySQL}; server = xx.xxx.xx.x; uid = xxxxxx; pwd = xxxxx; da tabase = xxxxx"


设置adoDataConn = Server.CreateObject(" ADODB.Connection")

adoDataConn.Open strConnection

________________________________________


然后我在我的页面中尝试了以下内容:


conn.RemainderStatusBBUK JobNumber,PONumber


''' '''JobNumber& PONumber是我的查询中的两个字段


set rs = server.createobject(" adodb.recordset")

conn.qGetRecords parm1,parm2,rs

如何定义Conn或用什么替换它?

谢谢

David



***通过开发人员指南 http://www.developersdex.com 发送* **

不要只是参加USENET ......获得奖励!
Bob,

Great to hear from you again. At least I know I can count on you for
great help.

I tried response.write...not much help really.
It would be much easier for me to run a query which is already saved in
th MS Access Back End and output the results direct into ASP.

My Query is called RemainderStatusBBUK

I already have an include file for the connection to the database:

_______________________________________
strConnection = "driver=
{MySQL};server=xx.xxx.xx.x;uid=xxxxxx;pwd=xxxxx;da tabase=xxxxx"

Set adoDataConn = Server.CreateObject("ADODB.Connection")

adoDataConn.Open strConnection
________________________________________

I then tried the following in my page:

conn.RemainderStatusBBUK JobNumber, PONumber

''''''JobNumber & PONumber are two fields in my Query

set rs = server.createobject("adodb.recordset")
conn.qGetRecords parm1,parm2, rs
How do I define Conn or what do I replace it with ?
Thanks
David


*** Sent via Developersdex http://www.developersdex.com ***
Don''t just participate in USENET...get rewarded for it!


这篇关于MS Access SQL&gt; ASP SQL问题....的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆