Talk with the Author
 Crystal Reports Forum : General Information : Talk with the Author
Message Icon Topic: DataTable from input file and report Post Reply Post New Topic
Author Message
KennethS
Newbie
Newbie
Avatar

Joined: 16 Nov 2009
Location: United States
Online Status: Offline
Posts: 2
Quote KennethS Replybullet 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. Confused

'' *** 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

         KeyWPrintTable = myRows1.CopyToDataTable
         '' myReport1.SetDataSource(dsSelected1)
         '' CrystalReportViewer1.ReportSource = myReport1

         '' *** 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. Ouch  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? Confused 
myReport1.SetDataSource(DS_fromGrid1) gave an error. 

 Kenneth S.
 

Internet marketer, software and Web site developer.
IP IP Logged
jkwrpc
Senior Member
Senior Member


Joined: 19 Jun 2007
Location: United States
Online Status: Offline
Posts: 432
Quote jkwrpc Replybullet 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.
 
Regards,
 
John W.
IP IP Logged
KennethS
Newbie
Newbie
Avatar

Joined: 16 Nov 2009
Location: United States
Online Status: Offline
Posts: 2
Quote KennethS Replybullet 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.
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
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



This page was generated in 0.063 seconds.