0

这是选择查询的语句。我收到错误消息:

用于 ODBC 驱动程序的 Microsoft OLE DB 提供程序错误“80040e14”[Microsoft][ODBC Microsoft Access Driver] FROM 子句中的语法错误。

Dim DataConn
Set DataConn = Server.CreateObject("ADODB.Connection")
DataConn.Open "Driver={Driver do Microsoft Access (*.mdb)}; DBQ="& Server.Mappath("db\wsmt.mdb") & ";pwd=openreach;"

Dim Recordset_report
Set Recordset_report = Server.CreateObject("ADODB.Recordset")

Dim sRet

if Request.form("submit1")<>"" then

    Recordset_report.Open "Select WP.CR_No as ""Cr No"", WP.WP_ID as""WP ID"", WP_Name as ""WP Name"","&_
" iif(isnull(ow1),' ',ow1+';')+' '+' '+iif(isnull(ow2),' ',ow2+';')+' '+' '+iif(isnull(ow3),' ',ow3+';')+' '+' '+iif(isnull(ow4),' ',ow4+';')+' '+' '+iif(isnull(ow5),' ',ow5) as ""Owner(s)"","&_
"Type as ""WP Type"", Release, Area, Rec_dt as ""Date Started"", Rec_from as ""Requirement Owner"","&_
"TCD,Perc_comp as ""% Completed"", Complexity, Status,Act_close as ""Actual Closed Date"" from wp, "&_

" inner join ( select wp_id,owner1,(select fullname from userinfo where userid=a.owner1) as ow1,owner2,"&_
" (select fullname from userinfo where userid=a.owner2) as ow2,owner3,"&_
" (select fullname from userinfo where userid=a.owner3) as ow3,owner4,"&_
" (select fullname from userinfo where userid=a.owner4) as ow4,owner5,"&_
" (select fullname from userinfo where userid=a.owner5) as ow5 from allocation a) as t,"&_
" on (wp.wp_id = t.wp_id) where Rec_dt >= #"&Request.form("from")&"# and "&_
" Rec_dt <= #"&Request.form("to")&"#  and not WP.Disable order by Rec_dt, "&_ 

" inner join (select tool_est,wp_id from estimation), "&_
" on (wp.wp_id = Estimation.wp_id) where Rec_dt >= #"&Request.form("from")&"# and ,"&_
" Rec_dt <= #"&Request.form("to")&"#  and not WP.Disable order by Rec_dt ", DataConn
4

1 回答 1

3

你正在做“ from wp, inner join”=>必须删除“,
在更好地审查它之后你有更多的情况你暗示”,你不应该。将尝试指出一些,但您应该查看查询。

您需要删除“,”:
as t, on (wp.wp_id = t.wp_id)

此外,在您订购之后order by Rec_dt
, inner join (select tool_est,wp_id from estimation), on
内部连接之前的“,”和 on 之前的都需要删除。另外,在最后一行之前的行中,and ,逗号两个应该被删除。

最后,您的最后一个内部连接不应该在它所在的位置,但我仍然没有得出结论,您是否真的想要一个内部连接,或者是否应该通过某种联合来解决。

于 2013-06-12T12:48:51.723 回答