logo

Warning: The forum is now for consultation only. Please use GitHub Discussions to post any questions or comments.


Welcome Guest ! To enable all features please Login or Register.

Notification

Icon
Error

Options
Go to last post Go to first unread
dhaval_bi  
#1 Posted : Monday, April 11, 2016 1:48:15 PM(UTC)
dhaval_bi

Rank: Newbie

Groups: Registered
Joined: 3/17/2016(UTC)
Posts: 8
United States

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.
epf  
#2 Posted : Monday, April 11, 2016 3:01:03 PM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

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.

thanks 1 user thanked epf for this useful post.
dhaval_bi on 4/11/2016(UTC)
dhaval_bi  
#3 Posted : Tuesday, April 12, 2016 6:51:53 AM(UTC)
dhaval_bi

Rank: Newbie

Groups: Registered
Joined: 3/17/2016(UTC)
Posts: 8
United States

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?
epf  
#4 Posted : Tuesday, April 12, 2016 8:29:59 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

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.
thanks 1 user thanked epf for this useful post.
dhaval_bi on 4/12/2016(UTC)
dhaval_bi  
#5 Posted : Tuesday, April 12, 2016 9:41:40 AM(UTC)
dhaval_bi

Rank: Newbie

Groups: Registered
Joined: 3/17/2016(UTC)
Posts: 8
United States

Thanks: 2 times
Can you please provide me the correct code(correct approach) which generates the report using DataTable
dhaval_bi  
#6 Posted : Wednesday, April 13, 2016 6:41:17 AM(UTC)
dhaval_bi

Rank: Newbie

Groups: Registered
Joined: 3/17/2016(UTC)
Posts: 8
United States

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.
epf  
#7 Posted : Thursday, April 14, 2016 7:27:43 AM(UTC)
epf

Rank: Administration

Groups: Administrators
Joined: 12/20/2013(UTC)
Posts: 1,209
Switzerland

Thanks: 14 times
Was thanked: 206 time(s) in 199 post(s)
Normally this code should work, check this again:
https://sealreport.org/f...=posts&t=102#post226
It is perhaps related to your SP loading....
Users browsing this topic
Guest
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.