jaylien1
asked on
Refresh Report with .NET Web Control
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.RefreshRepo rt() 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.S erverName = sServer
logOnInfo.ConnectionInfo.D atabaseNam e = sDB
logOnInfo.ConnectionInfo.U serID = sUser
logOnInfo.ConnectionInfo.P assword = sPW
logOnInfo.TableName = rptTable.Name
rptTable.ApplyLogOnInfo(lo gOnInfo)
rptTable.Location = rptTable.Name
Next
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.
For Each rptTable In oRpt.Database.Tables
' Set the connection information for current table.
logOnInfo.ConnectionInfo.S
logOnInfo.ConnectionInfo.D
logOnInfo.ConnectionInfo.U
logOnInfo.ConnectionInfo.P
logOnInfo.TableName = rptTable.Name
rptTable.ApplyLogOnInfo(lo
rptTable.Location = rptTable.Name
Next
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.
ASKER
Thanks for the suggestion mlmcc. Oh how I wish one of them would have solved it, but they didn't. I am not using the web component server for this and the url is different each time anyway. I know there has to be some way to do this, it seems to me that changing the logoninfo (thus changing the database to report off of) would signify that the report changed and cause the report to pull in the updated information. I believe now that the logoninfo isn't applying the second time through. Example: I have db1, db2, db3. The report, rpt.A, is designed against db1. The report is sitting on the web server. The asp .net page containing the viewer is requested with rpt.A, the asp .net page's onload event sets the logoninfo the that of the user requesting it, let's say it's db2. The report is displayed with the data from db2. If the user then changes their db connection to db3 and goes and requests the same report, the viewer displays the report with the data from db2 in it. It is almost as if the page_load event isn't being ran the second time the viewer is requested. Any other suggestions?
No ideas. I use VB and the application isn't web based.
mlmcc
mlmcc
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
http://support.crystaldecisions.com/library/kbase/articles/c2008005.asp
mlmcc