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

PrivateSub Page_Load(ByVal senderAs System.Object,ByVal eAs System.EventArgs)HandlesMyBase.Load

crpt =New CrystalReport1

ForEach myTableIn crpt.Database.Tables

myLogin = myTable.LogOnInfo

myLogin.ConnectionInfo.Password = "password"

myLogin.ConnectionInfo.UserID = "user"

myTable.ApplyLogOnInfo(myLogin)

Next

CrystalReportViewer1.ReportSource = crpt

CrystalReportViewer1.RefreshReport()

EndSub

rd in the code. Here is the code from the web form.
[1659 byte] By [zoom14151] at [2008-2-11]
# 1
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 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...
# 2
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

KeithThomson at 2007-9-8 > top of Msdn Tech,Visual Studio,Crystal Reports for Visual Studio...

Visual Studio

Site Classified