Error while executing a Report

Stimulsoft Reports.NET discussion
Post Reply
mkh1365
Posts: 3
Joined: Sun Aug 02, 2015 2:25 pm
Location: shiraz

Error while executing a Report

Post by mkh1365 »

when I try to do report.Show(); in c#, I get this error:
c:\Users\Morteza\AppData\Local\Temp\x0fka3ae.0.cs(37,27) : error CS1519: Invalid token ';' in class, struct, or interface member declaration


details of this error is :

System.Exception was unhandled
Message=c:\Users\Morteza\AppData\Local\Temp\x0fka3ae.0.cs(37,27) : error CS1519: Invalid token ';' in class, struct, or interface member declaration
Source=Stimulsoft.Report
StackTrace:
at Stimulsoft.Report.StiReport.Compile(String path, Stream stream, StiOutputType outputType, Boolean autoCreate, Object standaloneReportType)
at Stimulsoft.Report.StiReport.Compile()
at Stimulsoft.Report.Engine.StiReportV2Builder.RenderSingleReport(StiReport masterReport, StiRenderState renderState)
at Stimulsoft.Report.StiReport.RenderReport(StiRenderState renderState)
at Stimulsoft.Report.StiReport.Render(StiRenderState renderState, StiGuiMode guiMode)
at Stimulsoft.Report.StiReport.Show(Form parentForm, IWin32Window win32Window, Boolean dialogForm)
at Stimulsoft.Report.StiReport.Show()
at StimulTest.frmReportDynamic.btnShowReport_Click(Object sender, EventArgs e) in C:\Users\Morteza\Desktop\StimulTest5\StimulTest\frmReportDynamic.cs:line 222
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.RunDialog(Form form)
at System.Windows.Forms.Form.ShowDialog(IWin32Window owner)
at System.Windows.Forms.Form.ShowDialog()
at StimulTest.Form1.button2_Click(Object sender, EventArgs e) in C:\Users\Morteza\Desktop\StimulTest5\StimulTest\Form1.cs:line 28
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG& msg)
at System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID, Int32 reason, Int32 pvLoopData)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 reason, ApplicationContext context)
at System.Windows.Forms.Application.Run(Form mainForm)
at StimulTest.Program.Main() in C:\Users\Morteza\Desktop\StimulTest5\StimulTest\Program.cs:line 18
at System.AppDomain._nExecuteAssembly(RuntimeAssembly assembly, String[] args)
at System.AppDomain.ExecuteAssembly(String assemblyFile, Evidence assemblySecurity, String[] args)
at Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly()
at System.Threading.ThreadHelper.ThreadStart_Context(Object state)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean ignoreSyncCtx)
at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state)
at System.Threading.ThreadHelper.ThreadStart()
InnerException:




i attach my source code with backup of database and report file with name "Report888.mrt"
please help me
thanks
Attachments
StimulTest5.rar
(564.08 KiB) Downloaded 279 times
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: Error while executing a Report

Post by Jan »

Hello,

This exception occurs because you have report compilation error. Each report before render should be compiled. Your report "Report888.mrt" does not have error before modification. Problem in following code:

Code: Select all

report.Dictionary.Clear();

report.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Shz", "Server=.; Initial Catalog=StimulTest; Integrated Security=true;"));
report.RegData(dt);
report.Dictionary.Synchronize();
After this modification your report can't be compiled. Please replace line of code:

Code: Select all

report.Show();
to

Code: Select all

report.Design();
for debug purposes. Instead report rendering you receive report loaded in designer and you can run report checker or preview and can understand what happens with report and where compilation error is located.

Let me known if you need any help.

Thank you.
mkh1365
Posts: 3
Joined: Sun Aug 02, 2015 2:25 pm
Location: shiraz

Re: Error while executing a Report

Post by mkh1365 »

Hi
thanks Mr Jan for your reply
I got this code replaces the previous code :

report.Dictionary.Clear();
report.Dictionary.Databases.Add(new Stimulsoft.Report.Dictionary.StiSqlDatabase("Shz", "Server=.; Initial Catalog=StimulTest; Integrated Security=true;"));
report.RegData(dt);
report.Dictionary.Synchronize();
report.Design();
report.Render(false);

but it happened again error :(
Jan
Posts: 1265
Joined: Thu Feb 19, 2009 8:19 am

Re: Error while executing a Report

Post by Jan »

Hello,

Did you receive any report compilation error when designer is running and you press preview?

Thank you.
mkh1365
Posts: 3
Joined: Sun Aug 02, 2015 2:25 pm
Location: shiraz

Re: Error while executing a Report

Post by mkh1365 »

Hell,
No i didn't.
But i see just design of my report that don't show my data in report.
HighAley
Posts: 8430
Joined: Wed Jun 08, 2011 7:40 am
Location: Stimulsoft Office

Re: Error while executing a Report

Post by HighAley »

Hello.

There is something wrong with your report templates.
Please, go to the preview tab or use Report Checker to make your reports working.

Then change the Design() method back to Show().

Thank you.
Post Reply