Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Crystal Subreport in vs.net

Status
Not open for further replies.

vwhite

Programmer
Oct 4, 2001
87
AU
Hello,

I am new to Crystal Reports and have come across the following stumbling block.

I have created a crystal report and subreport in VS.NET 2003. I have also created 2 strongly typed datasets and 2 datadapters to fill the datasets. I then set the datasource of the reports to the 2 datasets as follows:

Dim rpt1 As New rptViewNewLicense 'MAIN REPORT
Dim rpt2 As New srptViewLicenseAssesment 'SUBREPORT
Dim ds1 As New dsViewLicense
Dim ds2 As New dsLicenseAssessment

Me.daViewLicense.Fill(ds1)
Me.daViewLicenseAssessment.Fill(ds2)
rpt1.SetDataSource(ds1)
rpt2.SetDataSource(ds2)
Me.crvReport.ReportSource = rpt1
Me.crvReport.Zoom(1)

This all runs fine but when the report is opened the Main Report asks for Database Logon information as follows:

Database Login
Table Name : GW_LICENSES_TBL_View_qry
Server Name
Database
Login ID
Password

This only occurs if the supreport is present in the Main report. Both reports display fine on their own. In addition to this both reports have used the ADO.NET datasets during development - so I wouldn't have thought it would need db login info anyway.

I have tried it with and without linked fields and get the same result. I have also tried setting the database logon using both TableLogOnInfo and also the Hotfix SetDatabaseLogon - all to no avail.





....vwhite

"Benefit others. If you cannot benefit others then do them no harm"
- His Holiness Tenzin Gyatso, the 14th Dalai Lama
 
Found the problem myself. I need to set the datasource of the subreport from within the Main Report

Dim rpt1 As New rptViewNewLicense
Dim ds1 As New dsViewLicense
Dim ds2 As New dsLicenseAssessment

Me.daViewLicense.Fill(ds1)
Me.daViewLicenseAssessment.Fill(ds2)
rpt1.SetDataSource(ds1)
rpt1.OpenSubreport("srptViewLicenseAssesment.rpt").SetDataSource(ds2)
Me.crvReport.ReportSource = rpt1
Me.crvReport.Zoom(1)



....vwhite

"Benefit others. If you cannot benefit others then do them no harm"
- His Holiness Tenzin Gyatso, the 14th Dalai Lama
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top