Refreshing a crystal report in asp.net
I have a report that I created in visual studio.net 2003. The report displays but the data in the report is old and out of date. I tried reportname.refresh() in the code but it gives a error message that login failed. I pass the username and passwo
Private
Sub Page_Load(ByVal senderAs System.Object,ByVal eAs System.EventArgs)HandlesMyBase.Loadcrpt =
New CrystalReport1ForEach myTableIn crpt.Database.TablesmyLogin = myTable.LogOnInfo
myLogin.ConnectionInfo.Password = "password"
myLogin.ConnectionInfo.UserID = "user"
myTable.ApplyLogOnInfo(myLogin)
NextCrystalReportViewer1.ReportSource = crpt
CrystalReportViewer1.RefreshReport()
EndSubrd in the code. Here is the code from the web form.
It sounds as though you have the data saved in the report the first time. When you built the report, right click on it, go to Designer->Default Settings.
Make sure "Discard Saved Data when Loading Reports" is checked on the report tab. At least, I believe this is the place to set that. The GUI is a bit different than the CR9 version I am used to.
After that, you are suffering from the Logon Exception that so many of us are. I'm still trying to find the answer on that one. If you find it, let us know.
ChR at 2007-9-8 >

This sounds similar to another post that I just replied to, from that one:
How did you connect to the database to create this report (ODBC, OLE DB, Native connection)? Is the ASP.NET server the same machine as the report designer?
If your report has saved data then it will preview fine to start, but it will be using the data that you had at design time. When you go to refresh it will then try to hit the database for the data. I would ensure that the report does not have saved data (in the report designer go to the file menu and unselect the Save Data with Report option) then save the report and try running it from your web page.
If you designed this report on another machine then it is possible that the ASP.NET server does not have the database client (access to SQL) or the ODBC datasource properly setup.
Keith - Business Objects