Refresh Report with .NET Web Control
Posted on 2003-11-04
I have a ton of reports, all with saved data turned off. The reports are designed on a "in-house" database. The client database structure is exactly the same as our in-house database. I simply want to change the database at runtime to the database that the user/client is connected to and run the report against that database. The reports I am currently testing with do not require parameters. However, we have many that do. I have read that reports with parms seem to refresh more readily. Using the CrystalViewer1.RefreshReport() function doesn't work, nor does oRpt.Refresh() ,with oRpt being an object of type ReportDocument. I have the logon code in place, and am relatively certain that it works, here it is:
For Each rptTable In oRpt.Database.Tables
' Set the connection information for current table.
logOnInfo.ConnectionInfo.ServerName = sServer
logOnInfo.ConnectionInfo.DatabaseName = sDB
logOnInfo.ConnectionInfo.UserID = sUser
logOnInfo.ConnectionInfo.Password = sPW
logOnInfo.TableName = rptTable.Name
rptTable.Location = rptTable.Name
When I run the report the first time it will connect to the database and get the information to fill the
report. If I close the viewer, change my db connection, and re-run the report...the old data from my previous db connection is still there. Again, this is an asp.net application and again the refreshes don't work. Any help is much appreciated.