troubleshooting Question

how do I refresh Crystal report programatically to discard saved data Crsytal report viewer C# Visual Studio 2005

Avatar of indikad
indikad asked on
Crystal Reports.NET Programming
9 Comments1 Solution6221 ViewsLast Modified:
I am using the Crsyal report viewer control in C# ( Visual Studio 2005)
I use the attached code
the report loads - but loads with the saved data. I want it to refresh automatically.  

Thanks in advance.
rd.FileName = sPath;
 CrystalDecisions.Shared.TableLogOnInfo myLogin;
 foreach (CrystalDecisions.CrystalReports.Engine.Table myTable in rd.Database.Tables )
            {
                myLogin = myTable.LogOnInfo;
                myLogin.ConnectionInfo.Password = "pwd"; 
                myLogin.ConnectionInfo.UserID = "sa";
                myLogin.ConnectionInfo.DatabaseName = "dbname";
                myLogin.ConnectionInfo.ServerName = "servername";
                myTable.ApplyLogOnInfo(myLogin); 
            }
            crystalReportViewer.ReportSource = rd;            
            rd.Refresh();
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 9 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 9 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros