我收到此错误。有没有办法调试错误?
代码在下面,第2064行是最后一行之前的行, "设置rsTemp = ConnTemp.execute(InputQuery)"
用于SQL Server的Microsoft OLE DB提供程序错误' 80040e57'
将表达式转换为数据类型smalldatetime的算术溢出错误。
AsPPage.asp,第2064行
<%
rsTemp.close
set rsTemp=nothing
ConnTemp.close
set ConnTemp=nothing
end sub
sub query2table(InputQuery, InputDSN, CompletedSection)
dim ConnTemp, rsTemp
set ConnTemp=server.createobject("adodb.connection")
ConnTemp.ConnectionTimeout = 0 ' Do not allow timeouts.
ConnTemp.open InputDSN
if CompletedSection = "Y" and instr(1, InputQuery, "Acknowledged_By") > 0 then
InputQuery = replace(InputQuery, "Acknowledged_By", "CompletedBy")
InputQuery = replace(InputQuery, "viewOrders.AcknowledgedBy AS CompletedBy", "viewOrders.CompletedBy")
end if
if CompletedSection = "Y" and instr(1, InputQuery, "AcknowledgeDate") > 0 then
InputQuery = replace(InputQuery, "Date_Acknowledged", "CompletionDate")
InputQuery = replace(InputQuery, ", viewOrders.AcknowledgeDate AS Date_Acknowledged", "")
InputQuery = replace(InputQuery, ", viewOrders.AcknowledgeDate AS CompletionDate", "")
InputQuery = replace(InputQuery, ", viewOrders.CompletionDate, viewOrders.Ship_Status", ", viewOrders.CompletionDate, viewOrders.CompletedBy, viewOrders.Ship_Status")
end if
if instr(1, ucase(trim(InputQuery)), "DATE()") > 0 and Session("Database") = "SQLServer" then
InputQuery = replace(InputQuery, "Date()", Session("CurrentDateSyntax"))
end if
if rsAppName("AllowFormOrders") = false then
InputQuery = replace(InputQuery, "GROUP BY", "AND (viewOrders.FormOrder = 0) GROUP BY")
end if
if rsAppName("AllowPRIncentiveOrders") = false then
InputQuery = replace(InputQuery, "GROUP BY", "AND (viewOrders.PRIncentive = 0) GROUP BY")
end if
if rsAppName("AllowSpecimenOrders") = false then
InputQuery = replace(InputQuery, "GROUP BY", "AND (viewOrders.SpecimenOrder = 0) GROUP BY")
end if
if rsAppName("ShowRushColumnInApproversAndFulfillmentPages") = false then
InputQuery = replace(InputQuery, ", viewOrders.RushMaterialsASAP", "")
end if
if rsAppName("AllowRepositorySupplyBlinding") = false then
InputQuery = replace(InputQuery, ", viewBlindItemCounts_Waiting.LineItemCount, viewBlindItemCounts_Waiting.BlindItemCount FROM", _
", -2 AS LineItemCount, 0 AS BlindItemCount FROM")
InputQuery = replace(InputQuery, "viewBlindItemCounts_Waiting.LineItemCount, viewBlindItemCounts_Waiting.BlindItemCount, ", "")
InputQuery = replace(InputQuery, "LEFT JOIN viewBlindItemCounts_Waiting ON viewOrders.OrderNumber = viewBlindItemCounts_Waiting.OrderNumber", "")
InputQuery = replace(InputQuery, ", viewBlindItemCounts_Waiting.LineItemCount, viewBlindItemCounts_Waiting.BlindItemCount HAVING", " HAVING")
InputQuery = replace(InputQuery, ", viewBlindItemCounts_NonCompleted.LineItemCount, viewBlindItemCounts_NonCompleted.BlindItemCount FROM", _
", -2 AS LineItemCount, 0 AS BlindItemCount FROM")
InputQuery = replace(InputQuery, "viewBlindItemCounts_NonCompleted.LineItemCount, viewBlindItemCounts_NonCompleted.BlindItemCount, ", "")
InputQuery = replace(InputQuery, "LEFT JOIN viewBlindItemCounts_NonCompleted ON viewOrders.OrderNumber = viewBlindItemCounts_NonCompleted.OrderNumber", "")
InputQuery = replace(InputQuery, ", viewBlindItemCounts_NonCompleted.LineItemCount, viewBlindItemCounts_NonCompleted.BlindItemCount HAVING", " HAVING")
InputQuery = replace(InputQuery, ", viewBlindItemCounts_Cancelled.LineItemCount, viewBlindItemCounts_Cancelled.BlindItemCount FROM", _
", -2 AS LineItemCount, 0 AS BlindItemCount FROM")
InputQuery = replace(InputQuery, "viewBlindItemCounts_Cancelled.LineItemCount, viewBlindItemCounts_Cancelled.BlindItemCount, ", "")
InputQuery = replace(InputQuery, "LEFT JOIN viewBlindItemCounts_Cancelled ON viewOrders.OrderNumber = viewBlindItemCounts_Cancelled.OrderNumber", "")
InputQuery = replace(InputQuery, ", viewBlindItemCounts_Cancelled.LineItemCount, viewBlindItemCounts_Cancelled.BlindItemCount HAVING", " HAVING")
InputQuery = replace(InputQuery, ", viewBlindItemCounts_Completed.LineItemCount, viewBlindItemCounts_Completed.BlindItemCount FROM", _
", -2 AS LineItemCount, 0 AS BlindItemCount FROM")
InputQuery = replace(InputQuery, "viewBlindItemCounts_Completed.LineItemCount, viewBlindItemCounts_Completed.BlindItemCount, ", "")
InputQuery = replace(InputQuery, "LEFT JOIN viewBlindItemCounts_Completed ON viewOrders.OrderNumber = viewBlindItemCounts_Completed.OrderNumber", "")
InputQuery = replace(InputQuery, ", viewBlindItemCounts_Completed.LineItemCount, viewBlindItemCounts_Completed.BlindItemCount HAVING", " HAVING")
InputQuery = replace(InputQuery, ", viewBlindItemCounts_Completed.BlindItemCount ORDER BY ", " ORDER BY ")
InputQuery = replace(InputQuery, ", viewBlindItemCounts_Completed.LineItemCount ORDER BY ", " ORDER BY ")
end if
set rsTemp=ConnTemp.execute(InputQuery)
NumberOfFields=rsTemp.fields.count -1%>
答案 0 :(得分:2)
调试此类问题的最简单方法是在执行SQL的行上放置一个断点。然后使用immediate / watch / locals / autos窗口,您可以在执行之前获取SQL语句的内容。将其放入MSSMS中的新查询窗口,甚至是记事本中。通常,通过查看最终的SQL,您将看到您的问题。 IE,你的日期或其他地方没有引号。
如果您仍然没有看到问题,请在MSSMS中运行它。它有时会为您提供有关该问题的更多信息。如果没有,尝试将SQL分解为更小的部分,直到找出确切的问题。
如果你现在还不知道它是什么,Google吧,你可能不是第一个遇到这个问题的人。
希望这能回答你的问题,&#34;有没有办法调试错误?&#34;
答案 1 :(得分:0)
问题已解决。通过在Classic ASP代码中从数据库中操作smalldatetime数据类型中的数据来解决该问题。数据库中的一个表将datetime作为数据库上的数据类型而不是smalldatetime。更改修复了错误,我可以完全加载页面。