Report on DataTable
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Report on DataTable
I have a DataTable in C# ... can I run a report using that DataTable as "input" to the report?
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Report on DataTable
Basically, here is the code I tried:
StiReport report = new StiReport();
DataTable dTable = new DataTable("Data");
dTable.Columns.Add("col1", typeof(string));
DataRow drow = dTable.NewRow();
drow["col1"] = "test1";
drow = dTable.NewRow();
drow["col1"] = "test2";
report.RegData(dTable);
report.Dictionary.Synchronize();
StiWebDesigner1.Design(report);
... when I enter design mode, add a data band, add the col1 to the databand, and then hit preview ... the report shows nothing!
Also, under Data sources in design mode the "Data" datasource has an icon with a small black X at the bottom.
Is this supposed to work?
StiReport report = new StiReport();
DataTable dTable = new DataTable("Data");
dTable.Columns.Add("col1", typeof(string));
DataRow drow = dTable.NewRow();
drow["col1"] = "test1";
drow = dTable.NewRow();
drow["col1"] = "test2";
report.RegData(dTable);
report.Dictionary.Synchronize();
StiWebDesigner1.Design(report);
... when I enter design mode, add a data band, add the col1 to the databand, and then hit preview ... the report shows nothing!
Also, under Data sources in design mode the "Data" datasource has an icon with a small black X at the bottom.
Is this supposed to work?
Report on DataTable
Hello,
Please send us a sample project with data which reproduses the problem.
Thank you.
Please send us a sample project with data which reproduses the problem.
Thank you.
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Report on DataTable
Attached is a complete ASP.NET Web Site (no project file ... just use Open->Web Site).
This sample has the latest pre-release DLLs in the Bin folder ... but I tried the 2010 version with same results.
Basically when I run the report, I see no rows in the Data section (there should be 2).
Thanks!
This sample has the latest pre-release DLLs in the Bin folder ... but I tried the 2010 version with same results.
Basically when I run the report, I see no rows in the Data section (there should be 2).
Thanks!
- Attachments
-
- 830.Stimulsoft.zip
- (7.46 MiB) Downloaded 268 times
Report on DataTable
Hello,
Please check the following code:
Thank you.
Please check the following code:
Code: Select all
...
DataRow drow = dTable.NewRow();
drow["col1"] = "test1";
drow["col2"] = 1;
dTable.Rows.Add(drow);
drow = dTable.NewRow();
drow["col1"] = "test2";
drow["col2"] = 2;
dTable.Rows.Add(drow);
report.RegData(dTable);
...
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Report on DataTable
Ahhh!!! Thanks!!! Dumb mistake on my part.
Report on DataTable
No problems! Let us know if you have additional questions.
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Report on DataTable
Does this same technique work for the Preview tab when designing a report? I took that same project, added:
and
StiWebDesigner1.Design(report);
but the Preview mode does not show the records from the DataTable. Is there a callback or something to populate the data when in preview mode of the designer?
Thanks!
and
StiWebDesigner1.Design(report);
but the Preview mode does not show the records from the DataTable. Is there a callback or something to populate the data when in preview mode of the designer?
Thanks!
Report on DataTable
Hello,
For a web designer to view the report in preview, you must implement the GetPreviewDataSet event, where you need to get the data and pass them to the DataSet.
Thank you.
For a web designer to view the report in preview, you must implement the GetPreviewDataSet event, where you need to get the data and pass them to the DataSet.
Thank you.
-
- Posts: 251
- Joined: Fri Feb 04, 2011 11:46 am
- Location: San Diego, CA
Report on DataTable
I added
StiWebDesigner1.GetPreviewDataSet += new StiWebDesigner.StiPreviewDataSetEventHandler(StiWebDesigner1_GetPreviewDataSet);
and
protected void StiWebDesigner1_GetPreviewDataSet(object sender, StiWebDesigner.StiPreviewDataSetEventArgs e)
{
// This is never hit!
}
but my StiWebDesigner1_GetPreviewDataSet is never called even when I hit preview. Am I registering it correctly?
thx!
StiWebDesigner1.GetPreviewDataSet += new StiWebDesigner.StiPreviewDataSetEventHandler(StiWebDesigner1_GetPreviewDataSet);
and
protected void StiWebDesigner1_GetPreviewDataSet(object sender, StiWebDesigner.StiPreviewDataSetEventArgs e)
{
// This is never hit!
}
but my StiWebDesigner1_GetPreviewDataSet is never called even when I hit preview. Am I registering it correctly?
thx!