5

I create a C# program and connected to stimulsoft for Make Reports.

I send a Dataset with 2 Datatable to my report with below code:

DataSet ds = new DataSet();
dtP.TableName = "dtP";
dtF.TableName = "dtF";
ds.Tables.Add(dtP);
ds.Tables.Add(dtF);
Report.RegData(ds);
Report.Show();

and "Report" is stireport object.

when my report page shown. my report is empty.

And when sent just 1 datatable as Dataset to my report that's work well.


Solve:

with add below code to my c# program can solve my problem:

objStiReport.Dictionary.Clear();
objStiReport.RegData(ds);
objStiReport.Dictionary.Synchronize();
Saeed
  • 3,415
  • 3
  • 24
  • 41
Mahdi Radi
  • 429
  • 2
  • 10
  • 30

4 Answers4

4

I also had this problem. I tried many ways but no one solve the problem. I changed something in the dictionary in stimulsoft report designer.

1) choose the Data from Dataset, DataTable data adaptor type

2) Set a name for Name In Source property (for example DS)

3) Add some tables to DS and set the Name In Source of them to something like this DS.Table1. Note that it's important to set the Name In Source property of tables like this.

As I set the Name In Source property of tables like DS.TableName, the problem gone away for me.

Amin Saqi
  • 18,549
  • 7
  • 50
  • 70
2
 1. Merge your 2 datables

dtP.Merge(dtF, false, MissingSchemaAction.Add);

 1. fill your report with datatable
Report.RegData(dtP);

another way (if datatable are not able to be merge ) is to create one datatable with all column of each datatable

you can create a datarelation to establish a relationship between two datatables but can RegData method understand a relationship (datarelationp) ?

Hassan Boutougha
  • 3,871
  • 1
  • 17
  • 17
  • i can't. because dtp and dtf datatable has namesake columns. and i want create relationship between 2 datatables in stimulsoft. – Mahdi Radi Aug 29 '12 at 14:08
  • when 2 datatables load in stimulsoft report, i create a relationship between 2 datatables and show in my report. but my problem is that i cant load 2 datatable in one report sametime. – Mahdi Radi Aug 29 '12 at 15:13
  • I understand so you can make a single datatable from two datatables (create a new datatable that have column of each table) so you will provide only one datatable to your Report – Hassan Boutougha Aug 29 '12 at 17:06
0
  1. First open report with stimul report designer

  2. In top of Dictionary tab, click on 'Action', and select 'Import XML Schema' and select your dataset file (with XSD extention) select 'Import XML Schema' and select your dataset file

  3. For add other dataset repeat step 2 but select 'Merg XML Schema'

  4. On your app code, use like this:

     StiReport report = new StiReport();
     report.Load(Server.MapPath(@"Report.mrt"));
     report.Compile();
    
     report.RegData(myDataSet1);
     report.RegData(myDataSet2);
     StiMobileViewer1.Report = report;
    
Stephen Rauch
  • 47,830
  • 31
  • 106
  • 135
0

I use this code:

            DataSet PrintData = GetDataFromDb();
            StiReport report = new();
            StiPdfExportSettings pdfSettings = new();
            string exePath = Path.GetDirectoryName(System.Reflection.Assembly.GetExecutingAssembly().Location);
            string fileName = string.Concat(PrintFile, ".mrt");
            string printPath = Path.Combine(exePath, "Report", PrintDiscipline, fileName);
            ExportFile = string.Concat(ExportFile, "-", DateTime.Now.Year, "-", DateTime.Now.Month, "-", DateTime.Now.Day);
            for (int i = 0; i < PrintData.Tables.Count; i++)
            {
                report.RegData(PrintData.Tables[i].TableName, PrintData);
                report.Load(printPath);
                report.Render();
            }
            report.ExportDocument(StiExportFormat.Pdf, ExportFile + ".Pdf", pdfSettings);
fery
  • 1
  • 2
  • Thank you for contributing to the Stack Overflow community. This may be a correct answer, but it’d be really useful to provide additional explanation of your code so developers can understand your reasoning. This is especially useful for new developers who aren’t as familiar with the syntax or struggling to understand the concepts. **Would you kindly [edit] your answer to include additional details for the benefit of the community?** – Jeremy Caney Jun 24 '23 at 00:32
  • Please add some more information about the code. – AztecCodes Jun 26 '23 at 11:40