Rank: Newbie
Groups: Registered
Joined: 3/17/2016(UTC) Posts: 8 Thanks: 2 times
|
I am using seal report dll and trying to generate report using the Dataset which my stored procedure is returning using this code:
ReportSource rs = new ReportSource(); ReportModel rm = new ReportModel(); rm.Name = "myModel"; rm.ResultTable = new DataTable(); rm.ResultTable = dsEmployee.Tables[0]; //This is my table returned by Stored procedure rs.Report = new Seal.Model.Report(); rs.Report.Models.Add(rm); ReportExecution execution = new ReportExecution(); execution.Report = rs.Report; execution.Execute(); while (report1.Status != ReportStatus.Executed) System.Threading.Thread.Sleep(100); string result = execution.GenerateHTMLResult(); Process.Start(result);
I am getting an error on this line: rs.Report = new Seal.Model.Report();
And the error is- 'Could not load file or assembly 'Microsoft.Win32.TaskScheduler, Version=2.5.4.0, Culture=neutral, PublicKeyToken=0d013ddd5178a2ae' or one of its dependencies. The system cannot find the file specified.'
Any help would be greatly appreciated.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
You need to add an assembly to your project, check the assemblies referenced in the Seal Report project, it looks like you need Microsoft.Win32.TaskScheduler it is located in Seal-Report\Projects\SealLibrary\SharedLibraries\Microsoft.Win32.TaskScheduler.dll or with the Seal distribution.
|
1 user thanked epf for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/17/2016(UTC) Posts: 8 Thanks: 2 times
|
Thanks, it solved the dll related issue but still i am unable to view the report. Below is the code i am using to check the report status and generate the html-
while (rs.Report.Status != ReportStatus.Executed) System.Threading.Thread.Sleep(100); string result = execution.GenerateHTMLResult(); Process.Start(result);
But rs.Report.Status always return NotExecuted so is there anything wrong i am doing or missing something?
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
Did you check that it works for normal report ? According to your code, your approach is incorrect to set a DataTable in a Model, the ResultTable of the report models are rebuilt during the execution process, so you will loose it. You have to dive into the code (and probably modify it) to perform this. Good luck.
|
1 user thanked epf for this useful post.
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/17/2016(UTC) Posts: 8 Thanks: 2 times
|
Can you please provide me the correct code(correct approach) which generates the report using DataTable
|
|
|
|
Rank: Newbie
Groups: Registered
Joined: 3/17/2016(UTC) Posts: 8 Thanks: 2 times
|
We also tried this approach: Repository repository = Repository.Create(); Report report = Report.LoadFromFile(@"C:\ProgramData\Seal Report Repository\Reports\NewReportWithSP1.srex", repository); ReportExecution execution = new ReportExecution() { Report = report }; execution.Execute(); while (report.Status != ReportStatus.Executed) System.Threading.Thread.Sleep(100); string result = execution.GenerateHTMLResult(); Process.Start(result);
In the above block, we are referring to a report designer file that we created from the report designer tool. But the code gets stuck in an infinite loop at the highlighted line- report.Status always returns status as NotExecuted.
However; when we execute the same srex file using report designer, it works just fine in the web browser.
|
|
|
|
Rank: Administration
Groups: Administrators
Joined: 12/20/2013(UTC) Posts: 1,209 Thanks: 14 times Was thanked: 206 time(s) in 199 post(s)
|
|
|
|
|
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.