简体   繁体   English

当我尝试以编程方式打开 Crystal Report 时,它没有打开

[英]Crystal Report doesn't open when I try to open it programmatically

I got a rpt file which executes a store procedure from sql server.我得到了一个 rpt 文件,它从 sql 服务器执行存储过程。 When I open it from Visual Studio 2019 with Main Report Preview and give it the parameter fields it opens with the correct values, when I try to open it programmatically it gives me this error The rowset column could not be found.当我使用 Main Report Preview 从 Visual Studio 2019 打开它并为其提供使用正确值打开的参数字段时,当我尝试以编程方式打开它时,它给我这个错误The rowset column could not be found. but when I place a breakpoint on the SetDatabaseLogon() and pass it with Step Over it opens.但是当我在SetDatabaseLogon()上放置一个断点并使用 Step Over 传递它时,它会打开。 Also I noticed that I need to give it its Parameter Values before SetDatabaseLogon() for this to work.我还注意到,我需要在SetDatabaseLogon()之前为其提供Parameter Values才能使其工作。 The issues seems to be the report attribute hasRecords when I pass over SetDatabaseLogon() with continue to another line hasRecords has an exception report.HasRecord threw an exception of type CrystalDescision.CrystalReports.Engine.LogonException but if I pass it with Step Over hasRecords is either true or false in which case my report opens as intended.问题似乎是当我传递SetDatabaseLogon()并继续到另一行时报告属性hasRecords hasRecords有一个异常report.HasRecord threw an exception of type CrystalDescision.CrystalReports.Engine.LogonException但是如果我通过 Step Over hasRecords传递它是无论是真还是假,在哪种情况下我的报告都会按预期打开。

I tried adding Thread.Sleep() on different lines but without any success.我尝试在不同的行上添加Thread.Sleep()但没有成功。 Also the store procedure works fine and it's fast, I have also tried to open it with the same Parameter Values I use when I verify database, another thing I tried is to open it without any Parameter Values in which case it did work.此外,存储过程工作正常并且速度很快,我还尝试使用验证数据库时使用的相同参数值打开它,我尝试的另一件事是在没有任何参数值的情况下打开它,在这种情况下它确实有效。

I assume that your report is in an older version.我假设您的报告是旧版本。 Firstly you need to verify database in the older version using Crystal Reports.首先,您需要使用 Crystal Reports 验证旧版本中的数据库。 Also don't forget to check database location and remove the database name incase it's static and you should set Alias same as stored procedure name.另外不要忘记检查数据库位置并删除数据库名称,因为它是 static,您应该将别名设置为与存储过程名称相同。 After that you have to open it from VS2019 and verify it again.之后你必须从VS2019打开它并再次验证它。 Problem solved.问题解决了。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM