Dynamic report - Crystal Report (C# .Net)

  • Thread starter Thread starter Climber
  • Start date Start date
C

Climber

Hello,

I want to now how to do a dynamic report with Crystal
Report (C# .Net), the number of colum and row are
different each time because they depend of my data base.

Thanks

Climber
 
Hi,

With the .NET version of CR you cannot create the report dynamically.

The number of rows is not important, as the report struct does not change
with this, the number of columns are the real concern.

Cheers,
 
I want to know how to change the DataBase path on
runtime ,same database same table but deferent
path "report with Crystal"
 
Hi,

I haven;t do that, but I think that if you change the ConnectionInfo of the
report it can be done, in fact in the code I posted you can see that I set
the ConnectionInfo and assign it to all of the tables I'm using, so in
theory you could even have different data sources for different tables in
the same report,
I include the code here again as I do not remember if I posted it on this
particular thread.

Hope this help,

--
Ignacio Machin,
ignacio.machin AT dot.state.fl.us
Florida Department Of Transportation

ConnectionInfo crConnectionInfo = new ConnectionInfo();

crConnectionInfo.ServerName = "127.0.0.1";

crConnectionInfo.DatabaseName = "CTP";

crConnectionInfo.UserID = "test";

crConnectionInfo.Password = "test";

foreach (CrystalDecisions.CrystalReports.Engine.Table table in
reportDocument1.Database.Tables)

{

TableLogOnInfo crTableLogonInfo = new TableLogOnInfo();

crTableLogonInfo.TableName = table.Name;

crTableLogonInfo.ConnectionInfo = crConnectionInfo;

crTableLogonInfos.Add( crTableLogonInfo);

table.ApplyLogOnInfo( crTableLogonInfo);

}

CrystalReportViewer1.LogOnInfo = crTableLogonInfos;

CrystalReportViewer1.ReportSource = reportDocument1;
 
Back
Top