你没有给参数赋值啊
  //报表参数
ReportParameter[] parameters = new ReportParameter[4];
//填充表头内容
 parameters[0] = new ReportParameter("参数名", "参数值");
  //设置参数
ReportViewer1.LocalReport.SetParameters(parameters);

解决方案 »

  1.   

    回楼上:
    Dim a As New ReportParameter("rp1", "barton")
      

  2.   

    VB啊,C#按照我那么些不会有问题的
      

  3.   

    See the end of this message for details on invoking 
    just-in-time (JIT) debugging instead of this dialog box.************** Exception Text **************
    Microsoft.Reporting.WinForms.LocalProcessingException: An error occurred during local report processing. ---> Microsoft.Reporting.DefinitionInvalidException: The definition of the report 'D:\1-Deve\Tomorrow\report\STclient.rptInstCAL.rdlc' is invalid. ---> Microsoft.ReportingServices.ReportProcessing.ReportProcessingException: The report definition is not valid.  Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition' which cannot be upgraded.
       at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.Phase1(ICatalogItemContext reportContext, Byte[] definition, IChunkFactory createChunkCallback, CheckSharedDataSource checkDataSourceCallback, ResolveTemporaryDataSource resolveTemporaryDataSourceCallback, DataSourceInfoCollection originalDataSources, IDataProtection dataProtection, String& description, String& language, DataSourceInfoCollection& dataSources, Boolean& hasExternalImages, Boolean& hasHyperlinks)
       at Microsoft.ReportingServices.ReportPublishing.ReportPublishing.CreateIntermediateFormat(ICatalogItemContext reportContext, Byte[] definition, IChunkFactory createChunkCallback, CheckSharedDataSource checkDataSourceCallback, ResolveTemporaryDataSource resolveTemporaryDataSourceCallback, DataSourceInfoCollection originalDataSources, PublishingErrorContext errorContext, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions, IDataProtection dataProtection, String& description, String& language, ParameterInfoCollection& parameters, DataSourceInfoCollection& dataSources, UserLocationFlags& userReferenceLocation, ArrayList& dataSetsName, Boolean& hasExternalImages, Boolean& hasHyperlinks)
       at Microsoft.ReportingServices.ReportProcessing.ReportProcessing.CreateIntermediateFormat(ICatalogItemContext reportContext, Byte[] reportDefinition, IChunkFactory createChunkFactory, CheckSharedDataSource checkDataSourceCallback, ResolveTemporaryDataSource resolveTemporaryDataSourceCallback, DataSourceInfoCollection originalDataSources, AppDomain compilationTempAppDomain, Boolean generateExpressionHostWithRefusedPermissions, ReportProcessingFlags processingFlags, IDataProtection dataProtection)
       at Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot)
       --- End of inner exception stack trace ---
       at Microsoft.Reporting.ReportCompiler.CompileReport(ICatalogItemContext context, Byte[] reportDefinition, Boolean generateExpressionHostWithRefusedPermissions, ControlSnapshot& snapshot)
       at Microsoft.Reporting.PreviewStore.StoredReport.EnsureCompiled(CatalogItemContextBase itemContext)
       at Microsoft.Reporting.PreviewStore.GetCompiledReport(CatalogItemContextBase context, Boolean rebuild, Byte[]& reportDefinition, ControlSnapshot& snapshot)
       at Microsoft.Reporting.LocalService.GetCompiledReport(CatalogItemContextBase itemContext, Boolean rebuild, ControlSnapshot& snapshot)
       at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
       --- End of inner exception stack trace ---
       at Microsoft.Reporting.WinForms.LocalReport.EnsureExecutionSession()
       at Microsoft.Reporting.WinForms.LocalReport.SetParameters(IEnumerable`1 parameters)
       at Common.Business.frmReport..ctor(String strRepTemplate, ReportDataSource rs, ReportParameter[] arrPara) in d:\1-Deve\Tomorrow\SGS.CN.GZ.Common.Utils\frmReport.cs:line 32
       at IETA.frmInstMana.btnInstCALStatReport_Click(Object sender, EventArgs e) in D:\1-Deve\Tomorrow\IETA\frmInstMana.vb:line 440
       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.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
      

  4.   

    The report definition is not valid.  Details: The report definition has an invalid target namespace 'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition' which cannot be upgraded.
      

  5.   


    那 如果我有些值是null值呢?就是有些参数可填可不填的,参数赋值的时候怎么处理?
      

  6.   

    [align=center][align=center][align=center][align=center][align=center][align=center][align=center][align=center][align=center]