HI GUYS
i have this problem ...
i'm designing report with crystal report 2008
at design time i connect to a db oracle 10
i have writed this code to change dbms in runtime
CrystalDecisions.ReportAppServer.DataDefModel.
ConnectionInfo rcConnectionInfo = rptcd.DatabaseController.GetConnectionInfos(null)[0].Clone(true);
CrystalDecisions.ReportAppServer.DataDefModel.
PropertyBag rcLogonInfo = (CrystalDecisions.ReportAppServer.DataDefModel.PropertyBag)rcConnectionInfo.Attributes["QE_LogonProperties"];
rcConnectionInfo.UserName = _DBUser;
rcConnectionInfo.Password = _DBPwd;
rcConnectionInfo.Attributes[
"QE_ServerDescription"] = _DBServer;
/*
rcConnectionInfo.Attributes["QE_DatabaseName"] = "";
rcConnectionInfo.Attributes["Database DLL"]="crdb_oracle.dll";
rcConnectionInfo.Attributes["QE_DatabaseType"]="Server Oracle ";
rcConnectionInfo.Attributes["QE_SQLDB"]="1";
rcConnectionInfo.Attributes["SSO Enabled"] = "0";
*/
rcLogonInfo[
"Server"] = _DBServer;
/*
rcLogonInfo["Trusted_Connection"] = "false";
*/
rcConnectionInfo.Attributes[
"QE_LogonProperties"] = rcLogonInfo;
rcConnectionInfo.Kind = CrystalDecisions.ReportAppServer.DataDefModel.
CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
// metodo 1
foreach (CrystalDecisions.ReportAppServer.DataDefModel.Table tbl in rptcd.DatabaseController.Database.Tables)
{
rptcd.DatabaseController.ModifyTableConnectionInfo(tbl.Name,rcConnectionInfo);
}
rptcd.DatabaseController.GetConnectionInfos(null).Remove(0);
rptcd.DatabaseController.GetConnectionInfos(null).Insert(0, rcConnectionInfo);
but when i open report... the data don't change
for the out i use a pdf document with byte stream with the follow procedure
byte[] ExportReportTo(CrystalDecisions.ReportAppServer.ClientDoc.ISCDReportClientDocument reportClientDocument, FormatoReport formato)
{
CrReportExportFormatEnum rasReportExportFormat;
switch (formato)
{
case FormatoReport.PDF:
rasReportExportFormat =
CrReportExportFormatEnum.crReportExportFormatPDF;
break;
default:
rasReportExportFormat =
CrReportExportFormatEnum.crReportExportFormatPDF;
break;
}
PrintOutputController rasPrintOutputController = reportClientDocument.PrintOutputController;
CrystalDecisions.ReportAppServer.CommonObjectModel.
ByteArray tempByteArray = rasPrintOutputController.Export(rasReportExportFormat, 0);
byte[] byteStreamOutput = tempByteArray.ByteArray;
return byteStreamOutput;
}
NB: in watch the rptcd and the relative tables ConnectionInfo is changed but in render the dbms is the same.. :(
there is some flag at design time that not allow change of dbms ?
what's the trouble ?
pls it's URGENT !!!
Edited by _jhorion - 13 Feb 2008 at 5:55am