【发布时间】:2011-03-29 13:20:24
【问题描述】:
我的用户希望能够直接打印我在 VS 2010 中设计的报表,而不是通过预览报表的过程来完成。我在 VS 2010 中设计了报告,使用那里的报告设计器,它创建了一个 .rdlc 文件。对于我的代码,我使用以下 MSDN 演练为例:
http://msdn.microsoft.com/en-us/library/ms252091(v=VS.80).aspx
在我的例子中,我不是在 XML 文件中,而是从 SQL Server 数据库中检索数据,并且我有一个 .xsd 文件等。另外,我正在将参数传递给报告。我将传递的数据集和 ReportParameters 分配给报告似乎没问题。下面是一段代码,最后一行是出现错误的那一行:
string deviceInfo =
"<DeviceInfo>" +
" <OutputFormat>EMF</OutputFormat>" +
" <PageWidth>8.5in</PageWidth>" +
" <PageHeight>11in</PageHeight>" +
" <MarginTop>0.4in</MarginTop>" +
" <MarginLeft>0.5in</MarginLeft>" +
" <MarginRight>0.5in</MarginRight>" +
" <MarginBottom>0.4in</MarginBottom>" +
"</DeviceInfo>";
Warning[] warnings;
m_streams = new List<Stream>();
report.Render("Image", deviceInfo, CreateStream, out warnings);
这是我收到的错误消息:
Microsoft.Reporting.WinForms.LocalProcessingException 未处理 Message=本地报告处理过程中发生错误。 源=Microsoft.ReportViewer.WinForms 堆栈跟踪: 在 Microsoft.Reporting.WinForms.LocalReport.InternalRender(字符串格式,布尔 allowInternalRenderers,字符串 deviceInfo,PageCountMode pageCountMode,CreateAndRegisterStream createStreamCallback,警告 [] 和警告) 在 Microsoft.Reporting.WinForms.LocalReport.Render(字符串格式,字符串 deviceInfo,PageCountMode pageCountMode,CreateStreamCallback createStream,警告 []& 警告) 在 Microsoft.Reporting.WinForms.LocalReport.Render(字符串格式,字符串 deviceInfo,CreateStreamCallback createStream,警告 []& 警告) 在 C:\Users\Rodf\Documents\Visual Studio 2010\Projects\SimpleWinForms\SimpleWinForms\PrintRfsDirectly.cs:line 62 中的 SimpleWinForms.PrintRfsDirectly.Export(LocalReport 报告) 在 C:\Users\Rodf\Documents\Visual Studio 2010\Projects\SimpleWinForms\SimpleWinForms\PrintRfsDirectly.cs 中的 SimpleWinForms.PrintRfsDirectly..ctor(spRequestForServicesReport2DataTable RfsTable, ReportParameter AmciName, ReportParameter ClientNumberParameter, ReportParameter CaseNumberParameter, ReportParameter ClientNameParameter, String RdlcFileName)第 35 行 在 SimpleWinForms.ShowReport.ShowReport_Load(Object sender, EventArgs e) 在 C:\Users\Rodf\Documents\Visual Studio 2010\Projects\SimpleWinForms\SimpleWinForms\ShowReport.cs:line 54 在 System.Windows.Forms.Form.OnLoad(EventArgs e) 在 System.Windows.Forms.Form.OnCreateControl() 在 System.Windows.Forms.Control.CreateControl(布尔 fIgnoreVisible) 在 System.Windows.Forms.Control.CreateControl() 在 System.Windows.Forms.Control.WmShowWindow(消息和 m) 在 System.Windows.Forms.Control.WndProc(消息和 m) 在 System.Windows.Forms.ScrollableControl.WndProc(消息和 m) 在 System.Windows.Forms.Form.WmShowWindow(消息和 m) 在 System.Windows.Forms.Form.WndProc(消息和 m) 在 System.Windows.Forms.Control.ControlNativeWindow.OnMessage(消息& m) 在 System.Windows.Forms.Control.ControlNativeWindow.WndProc(消息和 m) 在 System.Windows.Forms.NativeWindow.DebuggableCallback(IntPtr hWnd,Int32 msg,IntPtr wparam,IntPtr lparam) 在 System.Windows.Forms.SafeNativeMethods.ShowWindow(HandleRef hWnd,Int32 nCmdShow) 在 System.Windows.Forms.Control.SetVisibleCore(布尔值) 在 System.Windows.Forms.Form.SetVisibleCore(布尔值) 在 System.Windows.Forms.Control.Show() 在 SimpleWinForms.Form1.btnPrintRFS_Click(Object sender, EventArgs e) 在 C:\Users\Rodf\Documents\Visual Studio 2010\Projects\SimpleWinForms\SimpleWinForms\Form1.cs:line 55 在 System.Windows.Forms.Control.OnClick(EventArgs e) 在 System.Windows.Forms.Button.OnClick(EventArgs e) 在 System.Windows.Forms.Button.PerformClick() 在 System.Windows.Forms.Form.ProcessDialogKey(键 keyData) 在 System.Windows.Forms.Control.ProcessDialogKey(键 keyData) 在 System.Windows.Forms.Control.PreProcessMessage(消息和消息) 在 System.Windows.Forms.Control.PreProcessControlMessageInternal(控制目标,消息和消息) 在 System.Windows.Forms.Application.ThreadContext.PreTranslateMessage(味精和味精) 在 System.Windows.Forms.Application.ThreadContext.System.Windows.Forms.UnsafeNativeMethods.IMsoComponent.FPreTranslateMessage(味精和味精) 在 System.Windows.Forms.Application.ComponentManager.System.Windows.Forms.UnsafeNativeMethods.IMsoComponentManager.FPushMessageLoop(IntPtr dwComponentID,Int32 原因,Int32 pvLoopData) 在 System.Windows.Forms.Application.ThreadContext.RunMessageLoopInner(Int32 原因,ApplicationContext 上下文) 在 System.Windows.Forms.Application.ThreadContext.RunMessageLoop(Int32 原因,ApplicationContext 上下文) 在 System.Windows.Forms.Application.Run(窗体 mainForm) 在 c:\users\rodf\documents\visual studio 2010\Projects\SimpleWinForms\SimpleWinForms\Program.cs:line 18 中的 SimpleWinForms.Program.Main() 在 System.AppDomain._nExecuteAssembly(RuntimeAssembly 程序集,字符串 [] 参数) 在 System.AppDomain.ExecuteAssembly(字符串 assemblyFile,证据 assemblySecurity,String [] args) 在 Microsoft.VisualStudio.HostingProcess.HostProc.RunUsersAssembly() 在 System.Threading.ThreadHelper.ThreadStart_Context(对象状态) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态,布尔 ignoreSyncCtx) 在 System.Threading.ExecutionContext.Run(ExecutionContext executionContext,ContextCallback 回调,对象状态) 在 System.Threading.ThreadHelper.ThreadStart() 内部异常:Microsoft.ReportingServices.ReportProcessing.ProcessingAbortedException Message=报告处理过程中发生错误。 来源=Microsoft.ReportViewer.Common ExceptionLevelHelpLink=http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsProcessingAborted&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=1.0 SkipTopLevelMessage=false 堆栈跟踪: 在 Microsoft.ReportingServices.OnDemandProcessing.OnDemandProcessingContext.AbortHelper.ThrowAbortException(字符串 reportUniqueName) 在 Microsoft.ReportingServices.OnDemandProcessing.OnDemandProcessingContext.CheckAndThrowIfAborted() 在 Microsoft.ReportingServices.OnDemandProcessing.RetrievalManager.FetchData(Boolean mergeTran) 在 Microsoft.ReportingServices.OnDemandProcessing.RetrievalManager.PrefetchData(ReportInstance reportInstance,ParameterInfoCollection 参数,布尔型 mergeTran) 在 Microsoft.ReportingServices.OnDemandProcessing.Merge.FetchData(ReportInstance reportInstance,布尔合并事务) 在 Microsoft.ReportingServices.ReportProcessing.ReportProcessing.ProcessOdpReport(报告报告,OnDemandMetadata odpMetadataFromSnapshot,ProcessingContext pc,布尔快照处理,布尔 reprocessSnapshot,布尔 processUserSortFilterEvent,布尔 processWithCachedData,ErrorContext errorContext,DateTime executionTime,IChunkFactory cacheDataChunkFactory,StoreServerFilters storeServerParameters,GlobalIDOwnerCollection globalIDOwnerCollection,Sort EventInformation newUserSortInformation, String oldUserSortEventSourceUniqueName, ExecutionLogContext executionLogContext, OnDemandProcessingContext& odpContext) 在 Microsoft.ReportingServices.ReportProcessing.ReportProcessing.RenderReport(IRenderingExtension newRenderer、DateTime executionTimeStamp、ProcessingContext pc、RenderingContext rc、IChunkFactory cacheDataChunkFactory、IChunkFactory yukonCompiledDefinition、Boolean & dataCached) 在 Microsoft.Reporting.LocalService.CreateSnapshotAndRender(CatalogItemContextBase itemContext、ReportProcessing repProc、IRenderingExtension 渲染器、ProcessingContext pc、RenderingContext rc、SubreportCallbackHandler subreportHandler、ParameterInfoCollection 参数、DatasourceCredentialsCollection 凭据) 在 Microsoft.Reporting.LocalService.Render(CatalogItemContextBase itemContext,布尔 allowInternalRenderers,ParameterInfoCollection reportParameters,IEnumerable dataSources,DatasourceCredentialsCollection 凭据,CreateAndRegisterStream createStreamCallback,ReportRuntimeSetup runtimeSetup) 在 Microsoft.Reporting.WinForms.LocalReport.InternalRender(字符串格式,布尔 allowInternalRenderers,字符串 deviceInfo,PageCountMode pageCountMode,CreateAndRegisterStream createStreamCallback,警告 [] 和警告) 内部异常:Microsoft.ReportingServices.ReportProcessing.ReportProcessingException 消息=RfsDataSet 来源=Microsoft.ReportViewer.Common ExceptionLevelHelpLink=http://go.microsoft.com/fwlink/?LinkId=20476&EvtSrc=Microsoft.ReportingServices.Diagnostics.Utilities.ErrorStrings&EvtID=rsErrorCreatingDataReader&ProdName=Microsoft%20SQL%20Server%20Reporting%20Services&ProdVer=1.0 SkipTopLevelMessage=false 堆栈跟踪: 在 Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.RunDataSetQuery() 在 Microsoft.ReportingServices.OnDemandProcessing.TablixProcessing.RuntimeOnDemandDataSet.Process() 在 Microsoft.ReportingServices.OnDemandProcessing.RuntimeDataSet.ProcessConcurrent(对象线程集) 内部异常:【问题讨论】:
-
您的异常转储在变得有趣时被截断。
-
不幸的是,这就是 VS 2010 给我的全部。