Joined: 16 Nov 2009
Location: United States
Online Status: Offline
Posts: 2
Topic: DataTable from input file and report Posted: 17 Nov 2009 at 10:57am
I have tried for about 3 hours this week to get a DataTable (from an input file) to work with Crystal Reports. The code below are some of the things that I have tried.
'' *** Add existing DataTable to new DS. Dim KeyWPrintTable As New DataTable Dim dsSelected1 As DataSet = New DataSet("KeyWPrintTable")
Try
'' *** Copy KeyWSelectedTable into the new DataTable. Dim myRows1 = From s In KeyWSelectedTable.AsEnumerable _ Where s.Field(Of Integer)(4) > 1 Or _ s.Field(Of Integer)(5) > 1 Select s
'' *** Try to get data from grid into report. DS_fromGrid1 = CType(DataGridViewSelected.DataSource, DataSet) myReport1.SetDataSource(DS_fromGrid1) CrystalReportViewer1.ReportSource = myReport1 '' CrystalReportViewer1
The DataTable was created from the input file so I cannot drag anything over into the report. I created the .rpt file and based it on the schema file DataSet2.xsd. What do I now need to do to get this report to fill with data and print? myReport1.SetDataSource(DS_fromGrid1) gave an error.
Kenneth S.
Internet marketer, software and Web site developer.
Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Posted: 19 Nov 2009 at 12:35pm
I am not certain how your dataset is constructed, nor whether dsSelected1 and DS_fromGrid1 are compatible. It does seem that you either need to have two tables in the dataset or append the records of one to original table which I take to be KeyWSelectedTable.
I dont know if either of these thoughts will help.
Joined: 16 Nov 2009
Location: United States
Online Status: Offline
Posts: 2
Posted: 19 Nov 2009 at 5:42pm
I only need some code to use either the Dataset or the Datatable. The .xsd file is set up and there is no database to create the Datatable from it. I cannot find any Bind code for the Crystal Report object to bind to the Datatable or Dataset.
--- Kenneth
Internet marketer, software and Web site developer.
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot delete your posts in this forum You cannot edit your posts in this forum You cannot create polls in this forum You cannot vote in polls in this forum