无效的索引(来自HRESULT的异常:0x8002000B)(DISP_E_BADINDEX)

时间:2019-05-31 00:32:19

标签: sql vb.net crystal-reports

尝试生成特定报告时出现此错误。我曾经在表中添加一列作为附加功能。 -每次生成报告时,都需要登录SQL凭据 -生成报告时,与原始sp比较的行数错误。 这是我的sp片段:

GO
/****** Object:  StoredProcedure [dbo].[spReportDailyActualSalesV5]    
Script Date: 30/05/2019 4:44:32 PM ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO

CREATE PROCEDURE [dbo].[spReportDailyActualSalesV8]
@From       DATETIME,
@To         DATETIME, 
@SUSelection VARCHAR(1000),
@SOSelection VARCHAR(1000),
@SGSelection VARCHAR(1000)

--here's the creation of my table
create table #Actuals
(
    Reftrn      VARCHAR(10),
    Docnum      VARCHAR(10),
    DocDte      DATETIME,
    SoldTo      VARCHAR(10),
    STName      VARCHAR(100),
    PosNum      VARCHAR(6),
    ItemNo      VARCHAR(20),
    ItemDs      VARCHAR(100),
    QtyNum      NUMERIC(14,2),
    Amount      NUMERIC(14,2),
    SOffice     VARCHAR(4),
    SGroup      VARCHAR(3),
    SUnits      VARCHAR(6),
    SeCode      VARCHAR(10),
    SeName      VARCHAR(20),
    SeLine      VARCHAR(50),
    SOCode      VARCHAR(10),
    SOName      VARCHAR(20),
    SUCode      VARCHAR(10),
    SUName      VARCHAR(20),
    target      NUMERIC(20,2),
    SOTgts      NUMERIC(20,2),
    SUTgts      NUMERIC(20,2),
    RsmSrt      NUMERIC(2,0),
    MatGrp      VARCHAR(150),
    Payer       VARCHAR(10),
    PYName      VARCHAR(100),
    SchedLine   DATETIME DEFAULT NULL,     -- ALHernandez: 20130805: 
Additional return field
    OReason     VARCHAR(100) --the additional feature in the table
)

--insert the contents after inserting values from another temp table
UPDATE #Actuals SET OReason = B.AUGRU FROM #Actuals A JOIN SOHeader B ON 
B.VBELN =A.Docnum

水晶报表参数字段

 @From
 @To 
 @SUSelection
 @SOSelection
 @SGSelection
 pLastSAPSync
 UserName
 @IsSplit

报表查看器

 ElseIf UCase(Session("ReportName")) = "DAILYACTUALSALES-EXTRACT" Then
            reportPath = 
Server.MapPath("~\SalesAnalysisReport\reports\rptDailyActualSales-RawData.rpt")
            pReportDoc.Load(reportPath)

            ' Pass parameters
            With pReportDoc
                .SetParameterValue("@From", New Date(Session("StartDate").ToString.Substring(0, 4), Session("StartDate").ToString.Substring(4, 2), Session("StartDate").ToString.Substring(6, 2), 0, 0, 0))
                .SetParameterValue("@To", New Date(Session("EndDate").ToString.Substring(0, 4), Session("EndDate").ToString.Substring(4, 2), Session("EndDate").ToString.Substring(6, 2), 0, 0, 0))
                .SetParameterValue("@SUSelection", Session("strSalesUnit"))
                .SetParameterValue("@SOSelection", Session("strSalesOffice"))
                .SetParameterValue("@SGSelection", Session("strSalesGroup"))
                .SetParameterValue("pLastSAPSync", Session("SAPSyncDate"))
                .SetParameterValue("UserName", Session("value1"))
                .SetParameterValue("@IsSplit", Session("IsSplit"))
            End With
            pReportDoc.SetDatabaseLogon(myConInfo.UserID, myConInfo.Password, myConInfo.ServerName, myConInfo.DatabaseName)

0 个答案:

没有答案