powered by simpleCommunicator - 2.0.39     © 2025 Programmizd 02
Форумы / Отчетные системы [игнор отключен] [закрыт для гостей] / SSRS, data source in custom code
2 сообщений из 2, страница 1 из 1
SSRS, data source in custom code
    #38553739
Max_Tpop
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
В пользовательском коде необходимо сделать запрос к БД. Можно ли как то получить строку соединения отчета?
Нашел код:
Код: vbnet
1.
2.
3.
4.
5.
6.
7.
8.
9.
10.
11.
12.
13.
14.
15.
16.
17.
18.
19.
20.
21.
22.
23.
24.
25.
26.
27.
28.
29.
30.
Public Function GetConnectString(strReportPath As [String]) As String
   Dim dataSources As DataSource()
   Dim dsReference As DataSourceReference
   Dim dsDefinition As New DataSourceDefinition()
   Dim dsPath As String
   Dim strConnectString As String = ""
   Dim rs As New ReportingService2010()
   
   ' adapt to Visual Studio  2010
   dataSources = rs.GetItemDataSources(strReportPath)
 
   If dataSources IsNot Nothing Then
      Dim dsItem As DataSource = dataSources(0)
      
      If dsItem.ToString() = "DataSourceReference" Then
 
         ' for shared data source
         dsReference = DirectCast(dsItem.Item, DataSourceReference)
         dsPath = dsReference.Reference
         dsDefinition = rs.GetDataSourceContents(dsPath)
         strConnectString = dsDefinition.ConnectString
      ElseIf dsItem.ToString() = "DataSourceDefinition" Then
 
         ' for embeded data source
         dsDefinition = DirectCast(dsItem.Item, DataSourceDefinition)
         strConnectString = dsDefinition.ConnectString
      End If
   End If
   Return strConnectString
End Function


Но увы ругается "тип DataSourceReference не определен".
Есть идеи как использовать DataSource в custom code?

ЗЫ: Отчет использует схему: http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition
...
Рейтинг: 0 / 0
SSRS, data source in custom code
    #38623403
philips
Скрыть профиль Поместить в игнор-лист Сообщения автора в теме
Участник
http://social.msdn.microsoft.com/Forums/sqlserver/en-US/27de3f46-5174-480d-b4d1-5e32772dae35/ssrs-2005-custom-code-shared-data-source-connection-string?forum=sqlreportingservices
Там же был ответ тока я ничего не понял куда подставлять
The type 'DataSourceReference' comes from Reporting Services's web service proxy class. Thus we add a web reference of the ReportingService2010.asmx (it is for SQL Server 2012) in our code to get the reference of all the classes used in the method posted by Zilong Lu.

The reporting service's web service URL would be http://<<your machine name>>/<<ReportServer Name>>/ReportingService2010.asmx. The report server URL can also be found at configuration tools --> reporting service configuration manager --> Report manager (tab)
А главное как потом получить значенее из кода
...
Рейтинг: 0 / 0
2 сообщений из 2, страница 1 из 1
Форумы / Отчетные системы [игнор отключен] [закрыт для гостей] / SSRS, data source in custom code
Целевая тема:
Создать новую тему:
Автор:
Закрыть
Цитировать
Найденые пользователи ...
Разблокировать пользователей ...
Читали форум (0):
Пользователи онлайн (0):
x
x
Закрыть


Просмотр
0 / 0
Close
Debug Console [Select Text]