Help with Crystal Reports

ahassan99

Member
Joined
Nov 24, 2007
Messages
9
Programming Experience
Beginner
Hi Guys,

I am using VB.Net 2003 with Crystal Reports 11 Developer. As I am new to this somehow, I am not sure of how to generate the report. I can generate the report if I set the datasource at design time to the access database directly. But what I need is to set the datasource as a dataview.

Also, the report is to be displayed in another form where the report viewer is. I am not sure whether to create the dataview in the first form and pass it when the button is click to the report form ,which I dont know how, or create ther dataview on the form_load event of the report form.

At the moment, I have the following code in the report form_load event. I know it is missing something which I don't know what.

da.Fill(Ds1, "CBMDB")
Dim itemdv As New DataView(Ds1.CBMDB)
Dim report As New rptitemslist
Dim rd As New ReportDocument
crviewer.ReportSource = report

I wish you can help me with this
 
CR.Net

Crystal Reports for .NET is a challenge; but, one thing I did was look at the vb.net samples that install with CR. They are very helpful.

The one thing I see missing is... how does the report know what database to connect to? There is no database connection information telling the report what database to use (unless this code is elsewhere).
 
I assume you aren't using Crystal within VS ? There you set the report datasource, so you tell it what dataSet to map to, and configured on the tableAdapters within that dataSet is your database connection info.

back to the OP. You haven't set the report datasource.

it should be:

VB.NET:
da.Fill(Ds1, "CBMDB")
Dim itemdv As New DataView(Ds1.CBMDB)
Dim report As New rptitemslist
Dim rd As New ReportDocument
[COLOR="Red"][B]report.setdatasource(whatever_your_dataSet) [/B][/COLOR]
crviewer.ReportSource = report

Where (whatever_your_dataSet) you need to set your datasource. I assume for you it will be (itemdv)
 
Back
Top