Crystal报表视图中的无效报表源 [英] Invalid report source in crystal report view
本文介绍了Crystal报表视图中的无效报表源的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我在查看rpt时遇到问题.
显示rpt时会给出无效的报告源错误
以下是代码
我已经添加了Crystal Report 8.5 Designer运行时库作为参考
I''m having a problem while viewing rpt.
It gives invalid report source error while displaying the rpt
Following is the code
I have added Crystal report 8.5 designer runtime library as a ref
Dim CrxApp As CRAXDDRT.Application
Dim CrxRep As CRAXDDRT.Report
Dim crxDatabase As CRAXDDRT.Database
Dim crxDatabaseTables As CRAXDDRT.DatabaseTables
Dim crxDatabaseTable As CRAXDDRT.DatabaseTable
CrxApp = New CRAXDDRT.Application
CrxRep = CrxApp.OpenReport("F:\FabInfo_Repo\Crystal\Report2.rpt")
'Set your Database object to the Report object's Database object
crxDatabase = CrxRep.Database
'Set your DatabaseTables object to the Database object's Tables object
crxDatabaseTables = crxDatabase.Tables
'Loop through each DatabaseTable object in the DatabaseTables collection and then set the location of the database file for each table
For Each crxDatabaseTable In crxDatabaseTables
'Use next line, if you are using Native connection to SQL database
crxDatabaseTable.SetLogOnInfo("Abcd\SQLExpress", "GSP1011")
Next crxDatabaseTable
crViewer91.ReportSource = CrxRep
crxDatabase = Nothing
crxDatabaseTable = Nothing
crxDatabaseTables = Nothing
推荐答案
尝试:
crViewer91.ReportSource = @"F:\FabInfo_Repo\Crystal\Report2.rpt";
要查看如何启动Crystal报表,请查看以下文章:使用带有数据集的C#创建Crystal报表 [ ^ ]
顺便说一句,我怀疑您是否可以使用路径报告,也可以使用数据库中的数据.因此,不要使用:
To look at how you can launch crystal reports, have a look at this article: Creating Crystal Reports using C# with Datasets[^]
BTW, I doubt you can use report from a path and also use data from DB. So, instead of using:
CrxRep = CrxApp.OpenReport("F:\FabInfo_Repo\Crystal\Report2.rpt")
使用
CrystalReport1 objRpt = new CrystalReport1();
并保持其余代码不变.试试吧.
and keep rest of the code same. Try out.
这篇关于Crystal报表视图中的无效报表源的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文