2011-06-10 92 views
1

我得到錯誤0x800A5077,我嘗試導入CrystalActiveXReportViewerLib10CrystalReportsCommonObjectModelLib,但它仍然沒有工作。

異常來自HRESULT:0x800A5077當執行水晶報告

Call ReportConnection(CInspAuditList, "Pab_Prod") 
     CInspAuditList.ReportFileName = My.Application.Info.DirectoryPath & "\MAuditList.rpt" 
     Call SubReportConnection(CInspAuditList, "Pab_Prod") 
     CInspAuditList.set_ParameterFields(0, "mchno; " & frmMachine.machine & " ;true") 
     CInspAuditList.set_ParameterFields(1, "batch; " & CDbl(frmMachine.batch) - 1 & " ;true") 
     CInspAuditList.set_ParameterFields(2, "Points; " & InpStdPt & " ;true") 
     CInspAuditList.set_ParameterFields(3, "ovrpt; " & OvrPoints & " ;true") 
     CInspAuditList.Action = 1 

發生錯誤時CInspAuditList.Action = 1

vb.net幫我申報CInspAuditList as AxCrystal.AxCrystalReport
這是我的連接功能:

Public Function ReportConnection(ByRef CrystalReport1 As AxCrystal.AxCrystalReport, ByRef dsnname As String) As Boolean 
     CrystalReport1.Connect = "dsn=" & dsnname & ";UID=" & gstrID & ";PWD=" & gstrPassword & ";DSQ=" 
    End Function 

我想知道原因的原因發生錯誤&我的連線是否正確

回答

0

發生在我身上的那是因爲報告文件(.rpt)包含到數據庫的連接,該數據庫不存在或無法通過運行程序解決方案的計算機找到:打開報告文件( .rpt),菜單數據庫,驗證數據庫,檢查連接參數(我的sql連接),確定,你可以看到一個msg,表示數據庫是最新的,ok,保存報告中的變化