2014-09-22 2 views
0

보고서에 매개 변수를 전달하려고하면 오류가 발생합니다.보고 할 매개 변수 전달 C#

처리되지 않은 'Microsoft.Reporting.WebForms.LocalProcessingException'형식의 예외가 Microsoft.ReportViewer.WebForms.dll에서 발생했습니다.

내 코드 :

ReportViewer reportViwer = new ReportViewer(); 
reportViwer.ProcessingMode = ProcessingMode.Local; 

reportViwer.LocalReport.ReportEmbeddedResource = "MyReport.Report1.rdlc"; 

List<ReportParameter> listReportParameter = new List<ReportParameter>(); 

listReportParameter.Add(new ReportParameter("Name", "Test")); 

reportViwer.LocalReport.SetParameters(listReportParameter); 

오류는 "SetParameters"입니다.

설명 : 어떤 도움을 주시면 더 좋구요

Microsoft.Reporting.WebForms.LocalProcessingException was unhandled 
    HResult=-2146233088 
    Message=An error occurred during local report processing. 
    Source=Microsoft.ReportViewer.WebForms 
    StackTrace: 
     at Microsoft.Reporting.WebForms.LocalReport.CompileReport() 
     at Microsoft.Reporting.WebForms.LocalReport.SetParameters(IEnumerable`1 parameters) 
     at MyReport.Form1.button1_Click(Object sender, EventArgs e) in e:\_Organizado\AERON\Projetos\Visual Studio C#\Relatorio\MyReport\Form1.cs:line 37 
     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 MyReport.Program.Main() in e:\_Organizado\AERON\Projetos\Visual Studio C#\Relatorio\MyReport\Program.cs:line 19 
     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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadHelper.ThreadStart() 
    InnerException: Microsoft.Reporting.DefinitionInvalidException 
     HResult=-2146233088 
     Message=The definition of the report 'Main Report' is invalid. 
     Source=Microsoft.ReportViewer.Common 
     ExceptionLevelHelpLink=http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=pvInvalidDefinition&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.0.21022.8 
     SkipTopLevelMessage=false 
     StackTrace: 
      at Microsoft.Reporting.ReportCompiler.CompileReport(CatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ReportSnapshotBase& snapshot) 
      at Microsoft.Reporting.StandalonePreviewStore.StoredReport.CompileReport() 
      at Microsoft.Reporting.StandalonePreviewStore.StoredReport.get_Snapshot() 
      at Microsoft.Reporting.StandalonePreviewStore.GetCompiledReport(CatalogItemContext context, Boolean rebuild, ReportSnapshotBase& snapshot) 
      at Microsoft.Reporting.LocalService.CompileReport(CatalogItemContext itemContext, Boolean rebuild) 
      at Microsoft.Reporting.WebForms.LocalReport.CompileReport() 
     InnerException: Microsoft.ReportingServices.ReportProcessing.ReportProcessingException 
      HResult=-2146233088 
      Message=The report definition is not valid. Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition' which cannot be upgraded. 
      Source=Microsoft.ReportViewer.Common 
      ExceptionLevelHelpLink=http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsProcessingError&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=9.0.21022.8 
      SkipTopLevelMessage=false 
      StackTrace: 
       at Microsoft.ReportingServices.ReportProcessing.ReportPublishing.Phase1(CatalogItemContext reportContext, Byte[] definition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, String& description, String& language, DataSourceInfoCollection& dataSources, UserLocationFlags& userReferenceLocation, Boolean& hasExternalImages, Boolean& hasHyperlinks) 
       at Microsoft.ReportingServices.ReportProcessing.ReportPublishing.CreateIntermediateFormat(CatalogItemContext reportContext, Byte[] definition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, PublishingErrorContext errorContext, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks) 
       at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileReport(CatalogItemContext reportContext, Byte[] reportDefinition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, PublishingErrorContext errorContext, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions, String& reportDescription, String& reportLanguage, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks) 
       at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(CatalogItemContext reportContext, Byte[] reportDefinition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions) 
       at Microsoft.Reporting.ReportCompiler.CompileReport(CatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ReportSnapshotBase& snapshot) 
      InnerException: 

!

+2

는 http://social.msdn.microsoft.com/Forums/en-US/47ecd315-6372-46cf-b319-df098334fc74/the-report-definition-has- (이 [스레드] 참조 -valid-target-namespace? forum = vsreportcontrols), 도움이 되었으면 좋겠습니다. – qqbenq

+0

Visual 2013을 사용하고 있습니다. 내 파일의 맨 위에 있습니다 :

답변

0

"Name"및 "Test"라는 이름의 매개 변수를 보고서에 추가하고 다시 시도하십시오.

이미 완료 한 경우에

this.reportViewer1.LocalReport.ReportEmbeddedResource = "MyReport.Report1.rdlc"; 

변경 시도 : 당신이 시도 할 수

this.reportViewer1.LocalReport.ReportPath = "MyReport.Report1.rdlc"; 

: Uncheck "이름"매개 변수의 Internal 속성입니다.

보고서에서 매개 변수의 등록 정보를 확인하십시오. (오른쪽 보고서 창에서 매개 변수를 선택 클릭합니다.)

UNCHECK - internal - 나는 문제를 해결 팁에

+0

이미이 매개 변수가 있지만 돈은 없습니다. 일하지 마라. –

1

감사합니다. 나는 폴더에 DLL을 얻을 referrence "Microsoft.ReportViewer.WebForms.dll"비주얼 스튜디오를 추가

:

C : \ 프로그램 파일 마이크로 소프트 비주얼 스튜디오 9.0 \ (86) \의 ReportViewer 마이크로 소프트 \. ReportViewer.WebForms.dll

내가 참조를 제거하고 브라우저 메뉴를 사용하여 다시 추가 폴더에있는 DLL을 선택

C : \ 프로그램 파일 (86) 마이크로 소프트 비주얼 스튜디오 \ 12.0 \의 ReportViewer \ Microsoft.ReportViewer .WebForms.dll

Warning[] warnings; 
string[] streamids; 
string mineType = ""; 
string encoding = ""; 
string extension = ""; 

byte[] bytePDF = reportViewer.LocalReport.Render("Pdf", null , out mineType, out encoding, out extension, out streamids, out warnings); 

오류 :

예외 : 슬로우됩니다. "보고서를 실행하는 데 필요한 하나 개 이상의 매개 변수가 지정되지 않은"그러나 지금 문제는 다음 줄에 (Microsoft.ReportingServices.ReportProcessing.ReportProcessingException) Microsoft.ReportingServices.ReportProcessing.ReportProcessingException이 throw되었습니다. "보고서를 실행하는 데 필요한 하나 이상의 매개 변수가 지정되지 않았습니다." 시간 : 22/09/2014 14시 59분 58초 스레드 [4236]

Microsoft.Reporting.WebForms.LocalProcessingException was unhandled 
    HResult=-2146233088 
    Message=An error occurred during local report processing. 
    Source=Microsoft.ReportViewer.WebForms 
    StackTrace: 
     at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings) 
     at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) 
     at Microsoft.Reporting.WebForms.LocalReport.Render(String format, String deviceInfo, PageCountMode pageCountMode, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) 
     at Microsoft.Reporting.WebForms.Report.Render(String format, String deviceInfo, String& mimeType, String& encoding, String& fileNameExtension, String[]& streams, Warning[]& warnings) 
     at MyReport.Form1.button1_Click(Object sender, EventArgs e) in e:\_Organizado\AERON\Projetos\Visual Studio C#\Relatorio\MyReport\Form1.cs:line 48 
     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 MyReport.Program.Main() in e:\_Organizado\AERON\Projetos\Visual Studio C#\Relatorio\MyReport\Program.cs:line 19 
     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.RunInternal(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state, Boolean preserveSyncCtx) 
     at System.Threading.ExecutionContext.Run(ExecutionContext executionContext, ContextCallback callback, Object state) 
     at System.Threading.ThreadHelper.ThreadStart() 
    InnerException: Microsoft.ReportingServices.ReportProcessing.ReportProcessingException 
     HResult=-2146233088 
     Message=One or more parameters required to run the report have not been specified. 
     Source=Microsoft.ReportViewer.Common 
     ExceptionLevelHelpLink=http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsParametersNotSpecified&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=1.0 
     SkipTopLevelMessage=false 
     StackTrace: 
      at Microsoft.ReportingServices.ReportProcessing.Execution.RenderReport.ValidateReportParameters() 
      at Microsoft.ReportingServices.ReportProcessing.Execution.RenderReportOdpInitial.PrepareForExecution() 
      at Microsoft.ReportingServices.ReportProcessing.Execution.RenderReport.Execute(IRenderingExtension newRenderer) 
      at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension newRenderer, DateTime executionTimeStamp, ProcessingContext pc, RenderingContext rc, IChunkFactory yukonCompiledDefinition) 
      at Microsoft.Reporting.LocalService.CreateSnapshotAndRender(ReportProcessing repProc, IRenderingExtension renderer, ProcessingContext pc, RenderingContext rc, SubreportCallbackHandler subreportHandler, ParameterInfoCollection parameters, DatasourceCredentialsCollection credentials) 
      at Microsoft.Reporting.LocalService.Render(String format, String deviceInfo, String paginationMode, Boolean allowInternalRenderers, IEnumerable dataSources, CreateAndRegisterStream createStreamCallback) 
      at Microsoft.Reporting.WebForms.LocalReport.InternalRender(String format, Boolean allowInternalRenderers, String deviceInfo, PageCountMode pageCountMode, CreateAndRegisterStream createStreamCallback, Warning[]& warnings) 
     InnerException: 
0

I 문제점을 해결했다.

테스트에 두 개의 매개 변수를 배치했기 때문에 보고서에 문제가 발생했으며 그 중 하나에 데이터를 전달하고있었습니다.

"이름"및 "테스트"매개 변수가 내 보고서에 작성되었으며 "이름"값만 전달했습니다.

listReportParameter.Add (new ReportParameter ("Name", this.textBox1.Text)); 

보고서에서 "테스트"매개 변수를 삭제했을 때 효과가있었습니다.

감사