title: Pass parameter to report c#
body: <p>I have an error when I try to pass a parameter to my report.</p>
  
  <p>An unhandled exception of type 'Microsoft.Reporting.WebForms.LocalProcessingException' occurred in Microsoft.ReportViewer.WebForms.dll.</p>
  
  <p>My code:</p>
  
  <pre><code>ReportViewer reportViwer = new ReportViewer();
  reportViwer.ProcessingMode = ProcessingMode.Local;
  
  reportViwer.LocalReport.ReportEmbeddedResource = "MyReport.Report1.rdlc";
  
  List&lt;ReportParameter&gt; listReportParameter = new List&lt;ReportParameter&gt;();
  
  listReportParameter.Add(new ReportParameter("Name", "Test"));
  
  reportViwer.LocalReport.SetParameters(listReportParameter);
  </code></pre>
  
  <p>The error is in "SetParameters".</p>
  
  <p>The description:</p>
  
  <pre><code>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&amp; m, MouseButtons button, Int32 clicks)
         at System.Windows.Forms.Control.WndProc(Message&amp; m)
         at System.Windows.Forms.ButtonBase.WndProc(Message&amp; m)
         at System.Windows.Forms.Button.WndProc(Message&amp; m)
         at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message&amp; m)
         at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message&amp; m)
         at System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
         at System.Windows.Forms.UnsafeNativeMethods.DispatchMessageW(MSG&amp; 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&amp;EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&amp;EvtID=pvInvalidDefinition&amp;ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&amp;ProdVer=9.0.21022.8
         SkipTopLevelMessage=false
         StackTrace:
              at Microsoft.Reporting.ReportCompiler.CompileReport(CatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ReportSnapshotBase&amp; snapshot)
              at Microsoft.Reporting.StandalonePreviewStore.StoredReport.CompileReport()
              at Microsoft.Reporting.StandalonePreviewStore.StoredReport.get_Snapshot()
              at Microsoft.Reporting.StandalonePreviewStore.GetCompiledReport(CatalogItemContext context, Boolean rebuild, ReportSnapshotBase&amp; 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&amp;EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&amp;EvtID=rsProcessingError&amp;ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&amp;ProdVer=9.0.21022.8
              SkipTopLevelMessage=false
              StackTrace:
                   at Microsoft.ReportingServices.ReportProcessing.ReportPublishing.Phase1(CatalogItemContext reportContext, Byte[] definition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, String&amp; description, String&amp; language, DataSourceInfoCollection&amp; dataSources, UserLocationFlags&amp; userReferenceLocation, Boolean&amp; hasExternalImages, Boolean&amp; hasHyperlinks)
                   at Microsoft.ReportingServices.ReportProcessing.ReportPublishing.CreateIntermediateFormat(CatalogItemContext reportContext, Byte[] definition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, PublishingErrorContext errorContext, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions, String&amp; description, String&amp; language, ParameterInfoCollection&amp; parameters, DataSourceInfoCollection&amp; dataSources, UserLocationFlags&amp; userReferenceLocation, ArrayList&amp; dataSetsName, Boolean&amp; hasExternalImages, Boolean&amp; hasHyperlinks)
                   at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CompileReport(CatalogItemContext reportContext, Byte[] reportDefinition, CreateReportChunk createChunkCallback, CheckSharedDataSource checkDataSourceCallback, PublishingErrorContext errorContext, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions, String&amp; reportDescription, String&amp; reportLanguage, ParameterInfoCollection&amp; parameters, DataSourceInfoCollection&amp; dataSources, UserLocationFlags&amp; userReferenceLocation, ArrayList&amp; dataSetsName, Boolean&amp; hasExternalImages, Boolean&amp; 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&amp; snapshot)
              InnerException: 
  </code></pre>
  
  <p>Any help is greatly appreciated!!</p>