ASP中的Microsoft VBScript编译错误“800a0401” [英] Microsoft VBScript compilation error '800a0401' in ASP
问题描述
运行程序时,我收到此错误
Microsoft VBScript编译错误''800a0401''
预计结束声明
/admin/currentmonth.asp,第26行
strSQL =" SELECT RFCInfo.Name,RFCInfo.Date,RFCInfo。 RFCN,RFCInfo.InvNo,RFCInfo.Deleted,InvoiceDetail.Quantity,InvoiceDetail.Description,InvoiceDetail.ExtendedPrice,InvoiceInfo.GST,InvoiceInfo.PST,InvoiceInfo.Total FROM RFCInfo INNER JOIN(InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.InvNo = InvoiceInfo.InvNo )在RFCInfo.InvNo = InvoiceInfo.InvNo,其中RFCInfo.DealerID =" &安培; strDealerID& " AND RFCInfo.Deleted = FALSE和RFCInfo.Date介于Date()和DateAdd(" m", - 1,Date())之间按RFCInfo.Date排序"
------- -------- ^
i需要显示最近一个月的记录,3个月的记录,6个月的记录和1年的单独记录。现在我要显示1个月的记录。但是在运行此代码时,在m下的这个sql语句中(在Date()和DateAdd(" m", - 1,Date())之间发生错误。
我正在使用ASP和Ms Access作为数据库。
任何人都知道为什么会出现这个错误。这是我们显示最近1个月记录的方式...如果我们将-1更改为-3,-6和所有最后3个月,那么最后6个月将被发现是正确的。
提前谢谢。
While running the program, i''m getting this error
Microsoft VBScript compilation error ''800a0401''
Expected end of statement
/admin/currentmonth.asp, line 26
strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted, InvoiceDetail.Quantity, InvoiceDetail.Description, InvoiceDetail.ExtendedPrice, InvoiceInfo.GST, InvoiceInfo.PST, InvoiceInfo.Total FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.InvNo = InvoiceInfo.InvNo) ON RFCInfo.InvNo = InvoiceInfo.InvNo where RFCInfo.DealerID =" & strDealerID & " AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between Date() And DateAdd("m",-1,Date()) Order By RFCInfo.Date"
---------------^
i need to display last one months records,3 months records, 6 month records and 1 yrs records seperatly. now i''m tring to display 1 month records. but while running this codes, in this sql statement under the "m" (Between Date() And DateAdd("m",-1,Date()) ) error occurs.
and i''m using ASP with Ms Access as database.
anyone have any idea why this error occurs. is this the way we can display the last 1 month records... like wise if we change the -1 to -3,-6 and all the last 3 months, last 6 months will be found out right.
Thanks in advance.
推荐答案
由datepart函数中的引号(")引起。如果你想在字符串中使用引号,你必须使用双引号("")
Caused by the quotes (") in the datepart function. If you want to use quotes within a string you will have to use double quotes ("")
我只是尝试给出" m"运行该程序。
strSQL =" SELECT RFCInfo.Name,RFCInfo.Date,RFCInfo.RFCNo,RFCInfo.InvNo,RFCInfo.Deleted,InvoiceDetail.Quantity,InvoiceDetail.Description, InvoiceDetail.ExtendedPrice,InvoiceInfo.GST,InvoiceInfo.PST,InvoiceInfo.Total FROM RFCInfo INNER JOIN(InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.InvNo = InvoiceInfo.InvNo)ON RFCInfo.InvNo = InvoiceInfo.InvNo其中RFCInfo.DealerID =" &安培; strDealerID& " AND RFCInfo.Deleted = FALSE和RFCInfo.Date在Date()和DateAdd之间(""""", - 1,Date())订购RFCInfo.Date"
和发生的错误是
用于ODBC驱动程序的Microsoft OLE DB提供程序错误''80040e10''
[Microsoft] [ODBC Microsoft Access驱动程序]太少参数。预期1.
/admin/last3months.asp,行132
和第132行是...设置objRS = objConn.Execute(strSQL)
-------------------------------------------- -------------------------------------------------- ------------
设置objRS = objConn.Execute(strSQL)
如果不是objRS.EOF那么
objRS.MoveFirst
currentinvno = objRS(3)
currentrfcno = objRs(2)
Do while not objRS.EOF
< tr>
显示表格内的所有内容
< / tr>
<%
objRS.MoveNext
Loop
%>
<%end if if%>
---------------------- -------------------------------------------------- ----------------------------------------
我也试过这个代码。
strSQL =" SELECT RFCInfo.Name,RFCInfo.Date,RFCInfo.RFCNo,RFCInfo.InvNo,RFCInfo.Deleted, InvoiceDetail.Quantity,InvoiceDetail.Description,InvoiceDetail.ExtendedPrice,InvoiceInfo.GST,InvoiceInfo.PST,InvoiceInfo.Total FROM RFCInfo INNER JOIN(InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.InvNo = InvoiceInfo.InvNo)ON RFCInfo.InvNo = InvoiceInfo.InvNo where RFCInfo.DealerID =" &安培; strDealerID& " AND RFCInfo.Deleted = FALSE和RFCInfo.Date在DateAdd(''d'', - Day(Date())+ 1,Date())和DateAdd(''m'',1,DateAdd(''d')之间', - Day(Date()) - 1,Date()))按RFCInfo.Date排序
错误发生是
Microsoft OLE DB Provider for ODBC Drivers错误''80040e10''
/admin/currentmonth.asp,行132
提前致谢
I just tried giving ""m"" and run the program.
strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted, InvoiceDetail.Quantity, InvoiceDetail.Description, InvoiceDetail.ExtendedPrice, InvoiceInfo.GST, InvoiceInfo.PST, InvoiceInfo.Total FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.InvNo = InvoiceInfo.InvNo) ON RFCInfo.InvNo = InvoiceInfo.InvNo where RFCInfo.DealerID =" & strDealerID & " AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between Date() And DateAdd(""m"",-1,Date()) Order By RFCInfo.Date"
and the error occured is
Microsoft OLE DB Provider for ODBC Drivers error ''80040e10''
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/admin/last3months.asp, line 132
and line 132 is... Set objRS = objConn.Execute(strSQL)
----------------------------------------------------------------------------------------------------------
Set objRS = objConn.Execute(strSQL)
If not objRS.EOF then
objRS.MoveFirst
currentinvno=objRS(3)
currentrfcno=objRs(2)
Do While Not objRS.EOF
<tr>
Display everything inside table
</tr>
<%
objRS.MoveNext
Loop
%>
<% end if %>
----------------------------------------------------------------------------------------------------------------
and i tried this code too.
strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted, InvoiceDetail.Quantity, InvoiceDetail.Description, InvoiceDetail.ExtendedPrice, InvoiceInfo.GST, InvoiceInfo.PST, InvoiceInfo.Total FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.InvNo = InvoiceInfo.InvNo) ON RFCInfo.InvNo = InvoiceInfo.InvNo where RFCInfo.DealerID =" & strDealerID & " AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between DateAdd(''d'',-Day(Date())+1,Date()) And DateAdd(''m'',1,DateAdd(''d'',-Day(Date())-1,Date())) Order By RFCInfo.Date"
error occurs is
Microsoft OLE DB Provider for ODBC Drivers error ''80040e10''
[Microsoft][ODBC Microsoft Access Driver] Too few parameters. Expected 1.
/admin/currentmonth.asp, line 132
If anyone have any idea what''s the problem, just help me. any other way to display current month,last 3 months,6 months,1 yrs records.
Thanks in advance
strSQL =" SELECT RFCInfo.Name,RFCInfo.Date,RFCInfo.RFCNo,RFCInfo.InvNo,RFCInfo.Deleted,InvoiceDetail.Quantity,InvoiceDetail.Description,InvoiceDetail.ExtendedPrice,InvoiceInfo。 GST,InvoiceInfo.PST,InvoiceInfo.Total FROM RFCInfo INNER JOIN(InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.InvNo = InvoiceInfo.InvNo)ON RFCInfo.InvNo = InvoiceInfo.InvNo其中RFCInfo.DealerID =" &安培; strDealerID& " AND RFCInfo.Deleted = FALSE和RFCInfo.Date介于Date()和DateAdd(" m", - 1,Date())之间按RFCInfo.Date排序"
------- -------- ^
strSQL = "SELECT RFCInfo.Name, RFCInfo.Date, RFCInfo.RFCNo, RFCInfo.InvNo, RFCInfo.Deleted, InvoiceDetail.Quantity, InvoiceDetail.Description, InvoiceDetail.ExtendedPrice, InvoiceInfo.GST, InvoiceInfo.PST, InvoiceInfo.Total FROM RFCInfo INNER JOIN (InvoiceDetail INNER JOIN InvoiceInfo ON InvoiceDetail.InvNo = InvoiceInfo.InvNo) ON RFCInfo.InvNo = InvoiceInfo.InvNo where RFCInfo.DealerID =" & strDealerID & " AND RFCInfo.Deleted = FALSE And RFCInfo.Date Between Date() And DateAdd("m",-1,Date()) Order By RFCInfo.Date"
---------------^
两个函数date()和dateAdd()需要在用于生成查询字符串的引号之外。尝试:
The two functions date() and dateAdd() need to be outside the quotes used to make the query string. Try:
这篇关于ASP中的Microsoft VBScript编译错误“800a0401”的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!