VB.Net and Crystal Reports

G

Guest

Hello

Does anybody know if there is a way to dynamically have a dataset linked to a predefined crystal report? The project initially was created to deal with a few static reports but now my client has the need for much more reporting and it would be much easier to do this dynamically, if at all possible

Current situation
User is coming from a form where parameters for a report are specified. These are then passed to the form that will generate the Crystal Report. From this point, a dataset would be created and based on the information, the query that was sent to the database would be displayed in the CrystalReportViewer.

I have yet to figure out a way around this because the crystal report cannot be created without a predefined dataset, and this would seem to suggest that the dataadapter would also have to be predefined. :(

Is there a better way of doing this??

Cheers

Karl
 
J

Jan Krouwer

Karl,

The following works if you want to change databases (the user can do this)

'set crystal reports to new database
Dim MyReport As New MyCrystalReport
Dim myTable As CrystalDecisions.CrystalReports.Engine.Table
Dim myLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
For Each myTable In MyReport.Database.Tables
myLogonInfo = myTable.LogOnInfo
With myLogonInfo.ConnectionInfo
.ServerName = DatabasePath & DatabaseProjectName
End With
myTable.ApplyLogOnInfo(myLogonInfo)
Next myTable

Jan

Hello,

Does anybody know if there is a way to dynamically have a dataset
linked to a predefined crystal report? The project initially was created to
deal with a few static reports but now my client has the need for much more
reporting and it would be much easier to do this dynamically, if at all
possible.
Current situation:
User is coming from a form where parameters for a report are
specified. These are then passed to the form that will generate the Crystal
Report. From this point, a dataset would be created and based on the
information, the query that was sent to the database would be displayed in
the CrystalReportViewer.
I have yet to figure out a way around this because the crystal report
cannot be created without a predefined dataset, and this would seem to
suggest that the dataadapter would also have to be predefined. :(
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top