0

I have VS2015 solution with Crystal Reports and CData Ado.net connection for the dataset. I have followed the instructions but my crystal report has three tables with two linked tables. The report fires and works with just the primary table but when i add the additional two tables the report does not work any more. I have tried inner join and left outer join on the crystal reports.

My code looks like this:

{
                SmartsheetDataAdapter dataAdapter = new SmartsheetDataAdapter(
                "SELECT * FROM Sheet_TempOrders", connection);
                DataSet set = new DataSet("_set");
                DataTable table = set.Tables.Add("_table");
                dataAdapter.Fill(table);
                report.SetDataSource(table);

                SmartsheetDataAdapter dataAdapter1 = new SmartsheetDataAdapter(
                "SELECT * FROM Sheet_Suppliers", connection);
                DataSet set1 = new DataSet("_set1");
                DataTable table1 = set1.Tables.Add("_table1");
                dataAdapter.Fill(table1);
                report.SetDataSource(table1);

                SmartsheetDataAdapter dataAdapter2 = new SmartsheetDataAdapter(
                "SELECT * FROM Sheet_Project", connection);
                DataSet set2 = new DataSet("_set2");
                DataTable table2 = set2.Tables.Add("_table2");
                dataAdapter.Fill(table2);
                report.SetDataSource(table2);

            }

TempOrders is the primary table. Any ideas on this?

Saqib Ali
  • 3,953
  • 10
  • 55
  • 100
Andrew Little
  • 27
  • 1
  • 7
  • Is the repeated `dataAdapter.Fill(...)` a typo? It should be `dataAdapter1.Fill(..)` and `dataAdapter2.Fill(...)` for the 2nd and 3rd calls. Can you explain what you mean when you say "the report does not work any more"? Are you seeing an error message? If so, can you let us know what the error message is? – Jerod Johnson Nov 26 '18 at 16:41
  • I tried both dataadapter and what you did too. The Crystal reports just displays a blank report with no data. I wonder if the report.SetDataSource is not the issue. I tried setting the 3 tables into one line but it creates an overload on SetDataSource – Andrew Little Nov 27 '18 at 12:56
  • i found a reference topic that recommended this code: report.Database.Tables[0].SetDataSource(table); report.Database.Tables[1].SetDataSource(table1); report.Database.Tables[2].SetDataSource(table2); When i did this i got an error on the group function, once i deleted the group some of the data worked but it appears to have losted the linking between the tables as table1 is loading first in the report not table. Not sure how to solve that one problem – Andrew Little Nov 27 '18 at 13:30
  • Can you edit your question to add the new code and share the exact error message you're seeing? – Jerod Johnson Nov 27 '18 at 15:00
  • Hi Jerod, thanks for your help, your support team has reached out to me and working with them on this currently. – Andrew Little Nov 27 '18 at 21:14

0 Answers0