public frmSSRSTest() { InitializeComponent(); //System.Reflection.Assembly ThisAssembly = System.Reflection.Assembly.GetExecutingAssembly(); //string gAppPath = ThisAssembly.Location; //gAppPath = gAppPath.Substring(0, gAppPath.LastIndexOf('\\') + 1); //gAppPath += "Logs\\"; //if (!System.IO.Directory.Exists(gAppPath)) //{ // System.IO.Directory.CreateDirectory(gAppPath); //} //logger = Logger.GetLogger(gAppPath, "SSRSTest"); //logger.LogMsg("Logger Initialized.", Logger.LogLevel.LogIsErr); logger = V4Utils.Logger.GetLogger("SSRSTest"); bw.WorkerReportsProgress = true; bw.WorkerSupportsCancellation = true; bw.DoWork += new DoWorkEventHandler(bw_DoWork); bw.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged); bw.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw_RunWorkerCompleted); BackgroundWorker bw2 = new BackgroundWorker(); bw2.WorkerReportsProgress = true; bw2.WorkerSupportsCancellation = true; bw2.DoWork += new DoWorkEventHandler(bw_DoWork); bw2.ProgressChanged += new ProgressChangedEventHandler(bw_ProgressChanged); bw2.RunWorkerCompleted += new RunWorkerCompletedEventHandler(bw2_RunWorkerCompleted); mvar_rs.Url = txtURL.Text + "reportservice2010.asmx"; //"http://localhost/ReportServer/reportservice2010.asmx"; //WebService url in ReportingServicesConfigurationManager; localhost = server name mvar_rs.Credentials = System.Net.CredentialCache.DefaultCredentials; }
private static DataSource[] GetSharedDataSource(ReportingService2010.ReportingService2010 rs, string reportsFolder, string reportName) { V4Utils.Logger logger; logger = V4Utils.Logger.GetLogger("SSRSTest"); try { DataSourceReference reference = new DataSourceReference(); DataSource ds = new DataSource(); reference.Reference = @"/"; //+ reportsFolder + "/" + "SharedDataSource"; ds.Item = (DataSourceDefinitionOrReference)reference; //Get original report Data Source Name DataSource[] reportDataSource = rs.GetItemDataSources(@"/" + reportsFolder + @"/" + reportName); ds.Name = reportDataSource[0].Name; //Testing: change existing data source name to match shared data source //ds.Name = "V4_SPPS_V6"; return new DataSource[] { ds }; } catch (System.Web.Services.Protocols.SoapException Err) { logger.LogMsg(Err.Detail.InnerXml.ToString(), Logger.LogLevel.LogIsErr); //WriteLog(Err.Detail.InnerXml.ToString()); } return null; }