• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 392
  • Last Modified:

CrystalReportViewer in Visual Studio 2005

Greeting,

I used Visual Studio 2005 Pro to create a web app. I want to manually set report source for crystalReportViewer instead of using the autobind value from crystalreport. Please take a look at my code below. My reports runs, but instead of using the data from 'ds', it uses the autobind value from CrystalReport1.rpt.

Dim ds As New system.data.DataSet()
adapter.Fill(ds)

Dim rpt As New CrystalDecisions.CrystalReports.Engine.ReportDocument()
rpt.Load(Server.MapPath("CrystalReport1.rpt")
rpt.SetdataSource(ds)
CrystalReportViewers.ReportSource=rpt


Thanks in advance.

 
0
mrong
Asked:
mrong
  • 4
  • 4
  • 3
2 Solutions
 
frodomanCommented:
Check your report and make sure you don't have 'Save Data With Report' checked.
0
 
mlmccCommented:
Agree.

One wya to check is to refresh the report when you view it.  If it is correct then you have data saved with the report.

mlmcc
0
 
mrongAuthor Commented:
how to change  'Save Data With Report' ?

Thanks.
0
How to Use the Help Bell

Need to boost the visibility of your question for solutions? Use the Experts Exchange Help Bell to confirm priority levels and contact subject-matter experts for question attention.  Check out this how-to article for more information.

 
mrongAuthor Commented:
I use Visual Studio 2005 Pro. It has CrystalReportViewer and CrystalReport build-in feature.

Thanks.
0
 
mlmccCommented:
I don't know in the .Net version

In the stand-alone version it is under the FILE menu or FILE --> OPTIONS

mlmcc
0
 
mlmccCommented:
You can also try this in code

rpt.DiscardSavedData

mlmcc
0
 
mrongAuthor Commented:
I haven't found the solution yet. It seems the CrystalReportViewer is using the dataset created while creating the report. It doesn't ake my dataset.
0
 
frodomanCommented:
Have you disabled saving the data with the report as we recommended?
0
 
mrongAuthor Commented:
I don't think there is 'Save Data With Report' feature in .Net version.
0
 
frodomanCommented:
Try this.  Rt-click on a blank spot in the report.  Select Designer -> Default Settings -> Reporting.  Check the box that says something like "Discard saved data when report loads".

0
 
mlmccCommented:
Try adding this line before calling the report

rpt.DiscardSavedData

mlmcc
0

Featured Post

[Webinar] Cloud and Mobile-First Strategy

Maybe you’ve fully adopted the cloud since the beginning. Or maybe you started with on-prem resources but are pursuing a “cloud and mobile first” strategy. Getting to that end state has its challenges. Discover how to build out a 100% cloud and mobile IT strategy in this webinar.

  • 4
  • 4
  • 3
Tackle projects and never again get stuck behind a technical roadblock.
Join Now