Print Page | Close Window

ReportDocument.SaveAs()

Printed From: Crystal Reports Book
Category: Crystal Reports for Visual Studio 2005 and Newer
Forum Name: Data Connectivity
Forum Discription: How to connect to data sources and export reports
URL: http://www.crystalreportsbook.com/forum/forum_posts.asp?TID=6917
Printed Date: 01 May 2024 at 2:52am


Topic: ReportDocument.SaveAs()
Posted By: AlexC
Subject: ReportDocument.SaveAs()
Date Posted: 01 Jul 2009 at 4:20am
Hi,
 
I'm a bit in a jam.  We want to change from Paradox 7 (don't ask) to SQL Server.  Which is easy enough.  Problem is there are more than 400 reports (with who knows how many subreports in them) which the datasource needs to change.  So I decided to plunge in the deep end and managed to change them with code similiar to :
 

ReportDocument doc = new ReportDocument();

try

{

doc.Load(stReport);

lResult = ProcessReportTables(doc);

if (ReportHasChanged)

{

string NewReport = NewReportName(stReport);

doc.SaveAs(NewReport);

}

}

to process the report, I find all the tables in the report and for each table do :
 

private bool DoReportTable(CrystalDecisions.CrystalReports.Engine.Table table)

{

table.LogOnInfo.ConnectionInfo.DatabaseName = ... ; table.LogOnInfo.ConnectionInfo.ServerName = ... ;

}
 
The doc.SaveAs(NewReport) gets executed and the 'new' .rpt file is there, but the report still refers to the old Paradox 7 tables.
 
Any ideas what I'm doing wrong ?


-------------
AlexC



Print Page | Close Window