on 03-10-2015 4:17 PM
Hi,
First off, I am new to this forum. I need to update the database configuration properties for a bulk of my crystal reports in BO 4.x. Specifically,
I need to change the database type, server, user, password, data source, etc... Also, I would like to change the default setting for these reports as well. What is the best way to go about doing this without having to go into each one individually? is using the .net sdk the best way? windows form application?
Thanks,
Actually, to start off, I would like to know how to change the data source from an odbc connection to a native oracle connection for my crystal reports without having to go to each one individually.
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.
Here's a sample of code from a class that I wrote for adding and updating reports in BO:
Get the report to be updated
private void updRpt(string rptFile, string alias, string rptDescrip, int folderID)
{
string query = "Select * from CI_INFOOBJECTS where SI_ID = " + _rptID.ToString();
using (InfoObjects io = _common.BOEInfoStore.Query(query))
{
if (io.Count > 0)
{
Report newRpt = (Report)io[1];
updateLogon(newRpt, alias);
newRpt.Save();
}
else
{
_errMsg = "Unable to update report: Report Not Found";
}
}
}
Change the DB Logon
private void updateLogon(Report newRpt, string alias)
{
for (int j = 1; j <= newRpt.ReportLogons.Count; j++)
{
//set the database alias, user ID, and password
newRpt.ReportLogons[j].UseOriginalDataSource = false;
newRpt.ReportLogons[j].CustomServerName = alias;
newRpt.ReportLogons[j].CustomUserName = _rptUser;
newRpt.ReportLogons[j].CustomPassword = _rptPW;
if (_setPrefix) //needed for Oracle database but maybe not others
{
for (int l = 1; l <= newRpt.ReportLogons[j].TableLocationPrefixes.Count; l++)
{
newRpt.ReportLogons[j].TableLocationPrefixes[l].UseMappedTablePrefix = true;
newRpt.ReportLogons[j].TableLocationPrefixes[l].MappedTablePrefix = _rptPrefix;
}
}
//if necessary, set the database driver
if (_updateDriver && (_dbDriver != DBDrivers.SQL_Server))
{
switch (_dbDriver)
{
case DBDrivers.Oracle:
newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeOracle;
break;
case DBDrivers.DB2:
newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeDB2;
break;
case DBDrivers.ADO:
newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeUserSpecified;
newRpt.ReportLogons[j].CustomDatabaseDLLName = "crdb_ado.dll";
break;
case DBDrivers.BTrieve:
newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeUserSpecified;
newRpt.ReportLogons[j].CustomDatabaseDLLName = "crdb_p2bbtrv.dll";
break;
case DBDrivers.ODBC:
newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeUserSpecified;
newRpt.ReportLogons[j].CustomDatabaseDLLName = "crdb_odbc.dll";
break;
case DBDrivers.OLAP:
newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeUserSpecified;
newRpt.ReportLogons[j].CustomDatabaseDLLName = "crdb_olap.dll";
break;
case DBDrivers.XML:
newRpt.ReportLogons[j].CustomServerType = CeReportServerType.ceServerTypeUserSpecified;
newRpt.ReportLogons[j].CustomDatabaseDLLName = "crdb_xml.dll";
break;
}
}
}
}
-Dell
If you go to my website: www.dellstinnett.com/sample_code.html, look for the BOECommonInfo assembly or one of the tutorial programs. All of those will show you how to log in to BO.
-Dell
User | Count |
---|---|
93 | |
10 | |
10 | |
9 | |
9 | |
7 | |
6 | |
5 | |
5 | |
4 |
You must be a registered user to add a comment. If you've already registered, sign in. Otherwise, register and sign in.