VB RS.exe - 未定义数据源
VB RS.exe - DataSource is not defined
我有这段代码可以以编程方式将报告导出为 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")
~~~~~~~~~~
我是不是忘记导入什么东西了?如果我删除该行它工作正常(除此之外它需要添加一个数据源)。预先添加数据源不是一个选项。
所以我想出了答案。我正在使用 Exec2005
(执行端点),它不包括 DataSource
的定义。我应该改为使用默认端点 (Mgmt2005
),但这会导致代码中出现其他问题。
无论如何,这个问题的答案是不使用-e Exec2005
。
我有这段代码可以以编程方式将报告导出为 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")
~~~~~~~~~~
我是不是忘记导入什么东西了?如果我删除该行它工作正常(除此之外它需要添加一个数据源)。预先添加数据源不是一个选项。
所以我想出了答案。我正在使用 Exec2005
(执行端点),它不包括 DataSource
的定义。我应该改为使用默认端点 (Mgmt2005
),但这会导致代码中出现其他问题。
无论如何,这个问题的答案是不使用-e Exec2005
。