Question Report doesn't load data

ilclaudio

New member
Joined
Nov 25, 2010
Messages
2
Programming Experience
Beginner
Hi all,
I'd like to viewa Crystal Report report using vb.net (Visual Studio 2008).
I've added the AxCRViewer control to the form and in the load event I execute the following code.
The problem is that the report (done with CR8.5 and a ttx file) doesn't load my data.
If I comment the line crReport.DiscardSavedData() it shows the default data of the ttx file, but if leave that line it doesn't load the data of the Data Source.
Which is the problem according to you?

The code:

Dim crApp As New CRAXDRT.Application()
Dim crReport As CRAXDRT.Report
crReport = crApp.OpenReport("<path>\reportTTX.rpt")
Dim queryString As String = "SELECT * FROM MV01_TESTATA_TURNO WHERE id_testata_turno=1"
Dim connectionString As String = <connection_string>
Dim connection = New SqlConnection(connectionString)
Dim dataAdapter As New SqlDataAdapter(queryString, connection)
Dim myDataSet As New DataSet
dataAdapter.Fill(myDataSet)
crReport.DiscardSavedData()
crReport.Database.SetDataSource(myDataSet.Tables(0))
AxCRViewer1.ReportSource = crReport
AxCRViewer1.ViewReport()

Thank you very much.
 
Back
Top