我有一個控制檯應用程序需要連接到SQL Server Express 2012上的SQL Reporting Services。 所有導出邏輯應該在單獨的dll中實現,並且路徑應該是動態的(我已經循環了各種服務器/報告的各種設置,並將它們逐個導出到Excel中)。以編程方式從SQL 2012 Reporting Services導出報表
我試圖按照這些教程:
http://www.aspose.com/docs/display/wordsreportingservices/Rendering+Reports+Programmatically
基本上,我添加的Web引用:
http://localhost:80/ReportServer_SQLEXPRESS12/ReportExecution2005.asmx
和
http://localhost:80/ReportServer_SQLEXPRESS12/ReportService2010.asmx
我的dll。看起來不錯,除了那些令人討厭的app.config設置(我將不得不稍後動態調整它們)。
然後我試圖做作爲例子:
// Create Web service proxies.
ReportingService2010.ReportingService2010 rs = new ReportingService2010.ReportingService2010();
ReportExecutionService.ReportExecutionService rsExec = new ReportExecutionService.ReportExecutionService();
,並得到了一些麻煩:
Error 76 The type or namespace name 'ReportExecutionService' does not exist in the namespace 'MyDllNamespace.ReportExecutionService' (are you missing an assembly reference?)
Error 74 The type or namespace name 'ReportingService2010' does not exist in the namespace 'MyDllNamespace.ReportingService2010' (are you missing an assembly reference?)
現在在哪兒我去下一個,我該如何使用Reporting Services API,如果我甚至不能創建代理對象?或者我應該更好地使用ServerReport類形式的Winforms ReportViewer而不是這些Web引用?
即使其中一個Microsoft示例在控制檯應用程序中使用ReportViewer,但在控制檯應用程序中導入Winforms似乎有些尷尬。
弄來使用溶液(代碼相關部分的提取物)*** http://DEVrpsw01/reportserver_reporting/reportexecution2005.asmx?wsdl ***? – Kiquenet
@Kiquenet:我最終使用'Microsoft.Reporting.WinForms.ServerReport'結合了接受答案中由tschmit007給出的代碼片斷。 – JustAMartin