How to change logon information in crystal reports at runtime

  • Thread starter Thread starter munish
  • Start date Start date
M

munish

I am using pull model in crystal reports.For simplicity I
m using only one table in SQL Server. I have tried
following code to change my database:
ConnectionInfo ci = new ConnectionInfo();
ci.ServerName = Changed_SERVER_NAME;
ci.DatabaseName = Changed_DATABASE_NAME;
ci.UserID = Changed_DATABASE_USER_NAME;
ci.Password = Changed_DATABASE_PASSWORD;
TableLogOnInfo li = new TableLogOnInfo();
li.ConnectionInfo = ci;
li.TableName = ChangedTableNameButSameStructure;
MyRep.Database.Tables.ApplyLogOnInfo(li);
crViewer.ReportSource = MyRep;
But when i view the report using crystal report viewer
control it shows me records of that table to which it was
connected to, when the report was designed.

Can anyone provide me help on this issue? Or tell me any
other way to change logon information, database and tables
at run time(in pull model)?
Thanx
munish
 
Back
Top