I use Crystal Reports for .NET, There’s option in Crystal Reports 2016
the option in File -> Save Data with Report Here’s image
when this option is turn on. the ReportDocument in .NET
doesn’t load data from SQL Server but it load from the saved data itself.
I have tons of report have this option turned on.
The strange thing in Delphi version the Crpe component. loads data normally from sql server whether the option enabled or disabled.
Am make sure 100% the connection to crystal the .NET code is works fine.
`foreach (Table crTable in doc.Database.Tables)
{
TableLogOnInfo crTableLogonInfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
crConnectionInfo.DatabaseName = "ExaSec" + CompanyNum + UserYear;
crConnectionInfo.ServerName = Server;
crConnectionInfo.IntegratedSecurity = string.IsNullOrWhiteSpace(UserID);
if (!string.IsNullOrWhiteSpace(UserID))
{
crConnectionInfo.UserID = UserID;
crConnectionInfo.Password = Password;
}
crConnectionInfo.Type = crTable.LogOnInfo.ConnectionInfo.Type;
crTableLogonInfo.ConnectionInfo = crConnectionInfo;
crTableLogonInfo.ReportName = crTable.LogOnInfo.ReportName;
crTableLogonInfo.TableName = crTable.LogOnInfo.TableName;
crTable.ApplyLogOnInfo(crTableLogonInfo);
}`
There’s a property in ReportDocument class called. ReportDocument .HasSavedData
which determine if report has saved data. I want to ignore saved data and use data from SQL Server directly!!
How to achieve this?
Software Memo is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.