locked
Datatable as data source in Crystal Report RRS feed

  • Question

  • User546194788 posted

    I knew how to use dataset as data source in CR.

    Is it possible to use datatable as data source in CR, like below?

    Rpt.SetDataSource(myDs.table(3))

    The reason is in myDs there are about 10 datatable.

    //myDs is a dataset, myDs.table(3) is a datatable in the myDS

    Tuesday, May 27, 2014 4:16 PM

All replies

  • User-1941247845 posted

    If you have defined an XSD along with the same DataTable name then you should be able to bind the DataTable as your source. However CrystalReports generally looks for the DS and then the specify DT while binding. Probably you can create a new DS with the same DataSet Name i.e. DataSet ds = new DataSet("Name") and then do a DataTable.COPY of the the required table from the original source to this new DS and then bind it.

    Hope this helps.

    Wednesday, May 28, 2014 3:39 AM
  • User-37275327 posted
    Rpt.Database.Tables[0].SetDataSource(MyDs.Tables[3]);
    Wednesday, May 28, 2014 3:40 AM