Aggiornamento DataConnection di SQL Reporting Services
-
03-07-2019 - |
Domanda
È possibile modificare la stringa di connessione di un report dei servizi di reporting sql pubblicato? Riesco a vedere il campo binario chiamato DataSource nel database di ReportServer, ma poiché è archiviato come binario non penso che sia facilmente aggiornabile.
Devo ripubblicare il rapporto con l'origine dati corretta? Spero di no dal momento che non voglio installare VS2003.
EDIT: il client esegue SQL Server 2000 Reporting Services con tutti i service pack installati.
Soluzione
SQL Reporting Services 2000 ha un [servizio web] ( http://msdn.microsoft.com/en-us/library/aa274396 (SQL.80) .aspx) che puoi utilizzare per modificare l'origine dati. Dato che, quanto segue, consente la modifica di un'origine dati in un'origine dati condivisa. Questo è stato [adattato da MSDN] ( http: // msdn.microsoft.com/en-us/library/aa225896(SQL.80).aspx) .
// Create our reporting services class
ReportingService theRS = new ReportingService();
theRS.Credentials = System.Net.CredentialCache.DefaultCredentials;
// We need to setup a data source reference to an existing shared data source
DataSourceReference theDSRef = new DataSourceReference();
theDSRef.Reference = "/Path/To/ExistingSharedDataSource";
DataSource[] theDSArray = new DataSource[1];
DataSource theDS = new DataSource();
theDS.Item = (DataSourceReference)theDSRef;
theDS.Name = "NameOfSharedDataSource";
theDSArray[0] = theDS;
try
{
// Attempt to change the data source of the report
theRS.SetReportDataSources("/Path/To/ReportName", theDSArray);
Console.Out.WriteLine("We have changed the data source");
}
catch (System.Web.Services.Protocols.SoapException e)
{
Console.Out.WriteLine(e.Message);
Console.Out.WriteLine(e.Detail.InnerXml.ToString());
}
In questo esempio, la classe ReportingService è presa dalla classe Proxy che ho generato per parlare con il servizio Web, che è descritto [qui] ( http://msdn.microsoft.com/en-us/library/aa256607 (SQL.80) aspx) .
Spero che questo aiuti alcuni. Fammi sapere se stai cercando qualcosa di diverso.