我通过使用rs.exe
和可视化基本文件以编程方式在服务器上上传报告。当用户查看报告时,服务器会要求凭据登录数据源。
现在,当我通过Visual Studio上传报告时,可以选择使用您可以预先设置的特定凭据,以便不提示用户。我还注意到报告中有一个设置,您可以在其中定义凭据。
我的问题是,如何在使用Visual Basic上传报表时启用特定数据源凭据,以便不提示用户输入数据源凭据?
我的VB代码:
Public Sub Main()
Try
Dim definition As [Byte]() = Nothing
Dim warnings As Warning() = Nothing
Dim stream As FileStream = File.OpenRead(RDL_LOCATION)
definition = New [Byte](stream.Length) {}
stream.Read(definition, 0, CInt(stream.Length))
warnings = rs.CreateReport(REPORT_NAME, "/" + REPORT_FOLDER, True, definition, Nothing)
If Not (warnings Is Nothing) Then
Dim warning As Warning
For Each warning In warnings
Console.WriteLine(warning.Message)
Next warning
Else
AddPolicies("/" + REPORT_FOLDER + "/" + REPORT_NAME, "False")
Console.WriteLine("Report: {0} PUBLISHED!", REPORT_NAME)
End If
Catch e As IOException
Console.WriteLine(e.Message)
Console.Read()
End Try
End Sub