Skip to Content
0
Former Member
Jul 23, 2009 at 11:16 AM

"Database login" when changing dataset in subreport

37 Views

Hi.

We've written a client/server solution, using Crystal Reports.

The server are running the code below, to populate the report, and save it with data.

After this function are executed, the file are sent to the client, and viewed en CrystalReportsViewer.

If there's no subreports in the report, everything words fine.

If there's one ore more subreports, the CrystalReportsViewer comes up with a "Database Login" dialog.

It seems that the SetDataSource doesnt have any effect on the subreports... :o(

Private Shared Function RunReport(ByVal Filename As String, ByVal Dset As DataSet)

Dim tmpfilename As String = My.Computer.FileSystem.GetTempFileName() & ".rpt"

Dim RPT As New ReportDocument

RPT.FileName = Filename

RPT.SetDataSource(Dset)

For Each subreport As ReportDocument In RPT.Subreports

subreport.SetDataSource(Dset)

Next

RPT.SaveAs(tmpfilename, True)

Dset.Dispose()

RPT.Dispose()

Return tmpfilename

End Function

Any suggestions?

Best regards

Karsten Balle