Quantcast
Channel: SCN : Discussion List - SAP Crystal Reports, version for Visual Studio
Viewing all articles
Browse latest Browse all 3636

Migrating a legacy .rpt file to use ado.net dataset

$
0
0

Hello again,

 

I am evaluating migration of old (CR 6) reports to VB.net VS2008 (and then to VS2013).  Using the CR tools in VS2008.  I am having a problem linking the ADO.Net DataSet Object with the legacy report.  I think this is due to a naming mismatch from the table/field references in the original legacy .rpt file and the new DataSet table names, etc.  Here is what I have attempted ( some code omitted).

 

Dim odbcCmd As New OdbcCommand

Dim cryRpt As New ReportDocument

 

        odbcCmd.CommandText = "SELECT el.PostDate, el.Severity, el.Message, el.Application, el.ErrorNumber, el.UserName, el.WorkStation, el.Extra FROM el_dbo.eventlog el WHERE el.PostDate >= { ts '2014-12-01 00:00:00' }  AND el.PostDate <= { ts '2014-12-08 15:30:00' } "

 

 

        Dim myAdapter As New OdbcDataAdapter()

        myAdapter.SelectCommand = odbcCmd

        Dim myDataSet As New DataSet()

        myAdapter.Fill(myDataSet, "el")

        cryRpt.Load("mtReport.rpt")

        cryRpt.SetDataSource(myDataSet)

        SetDBLogonForReport(myConnectionInfo, cryRpt)

        CrystalReportViewer1.ReportSource = cryRpt

        CrystalReportViewer1.Refresh()

 

I named the Dataset Table as "el" to match the query results.  When I look at the contents of the myDataSet, it looks like:

 

<NewDataSet>

  <el>

    <POSTDATE>2014-12-01T10:34:26-05:00</POSTDATE>

 

The report data fields look like this (from the legacy report file)

 

i2.PNG

 

However, when I run the report, I get this error:

 

 

i1.PNG

 

This leads me to believe that the report db fields cannot be found in the ado.net dataset because they are encased in the <NewDataSet> top-level element.  Is this a correct assessment, and if so, how to rectify?  Thanks.


Viewing all articles
Browse latest Browse all 3636

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>