VB RS.exe-未定义数据源

时间:2018-08-21 09:08:45

标签: vb.net reporting-services ssrs-2008 rs.exe

我有这段代码可以以编程方式将报告导出为PDF。

Public Sub Main()

TRY

 DIM historyID as string = Nothing
 DIM deviceInfo as string = Nothing
 DIM extension as string = Nothing
 DIM encoding as string
 DIM mimeType as string = "application/Excel"
 DIM warnings() AS Warning = Nothing
 DIM streamIDs() as string = Nothing
 DIM results() as Byte


 rs.Credentials = System.Net.CredentialCache.DefaultCredentials
 Dim dataSources() As DataSource = rs.GetItemDataSources("foldername/reportname")

 rs.LoadReport(REPORTSERVER_FOLDER, historyID)

 results = rs.Render(FORMAT, deviceInfo, extension, mimeType, encoding, warnings, streamIDs)

 DIM stream As FileStream = File.OpenWrite(FILENAME)
 stream.Write(results, 0, results.Length)
 stream.Close()

Catch e As IOException
  Console.WriteLine(e.Message)
End Try

End Sub

运行它时,我收到一条错误消息:

error BC30002: Type 'DataSource' is not defined.

 Dim dataSources() As DataSource = rs.GetItemDataSources("foldername/reportname")
                      ~~~~~~~~~~

我忘记导入东西了吗?如果我删除该行,则可以正常工作(除了需要添加数据源之外)。不能预先添加数据源。

1 个答案:

答案 0 :(得分:0)

所以我想出了答案。我正在使用\TYPO3\CMS\Core\Utility\ExtensionManagementUtility::makeCategorizable( 'my_ext', 'my_table_name', 'type', [ 'label' => 'Type', 'exclude' => false, 'config' => [ 'eval' => 'required', ] ] ); (执行端点),其中不包括Exec2005的定义。我应该改用默认端点(DataSource),但这会在代码中引起其他问题。

无论如何,这个问题的答案是不要使用Mgmt2005