Skip to Content

Archived discussions are read-only. Learn more about SAP Q&A

Setting LogonInfo to crystal report viewer

Hello All,

I have a problem setting up the Logon info to the crystal report viewer.

Here is my code.

// this is how I will be searching the InfoStore for the specified report template id..

objects = infoStore.Query("Select SI_ID from ci_infoobjects where SI_NAME='" + objectName + "' and SI_PARENT_FOLDER=" + parentID.ToString() + " and SI_Instance=0");

if (objects.Count != 1) return (-1);

// GLTxnReportViewer is the crystalreportviewer control

this.GLTxnReportViewer.ReportSource = objects[1].ID;

this.GLTxnReportViewer.EnterpriseLogon = reportObject.BOEnterpriseSession;

// this code is for getting the report datasource, user id and pwd..

TableLogOnInfos oTblLogOnInfos = new TableLogOnInfos();

TableLogOnInfo oTblLogOnInfo = new TableLogOnInfo();

ConnectionInfo oConInfo = new ConnectionInfo();

oConInfo.ServerName = ConfigurationManager.AppSettingssReportDataSource;

oConInfo.UserID = ConfigurationManager.AppSettingssReportUserId ;

oConInfo.Password = ConfigurationManager.AppSettingssReportPwd ;

oTblLogOnInfo.ConnectionInfo = oConInfo;


// end of the login code..

this.GLTxnReportViewer.LogOnInfo = oTblLogOnInfos;

So as shown in the above code, i will be getting the d/b datasource, userid and pwd from the config file, construct the tableloginInfos and set it to the crystal report viewer logoninfo.

My ultimate purpose is, i should be able to change the logon info dynamically when i change it in config file. i should not go to the cmc and modify the d/b parameters for that report.

The report works when the d/b info which i used while publishing the report matches with the config d/b info. If the d/b info differs, then it is throwing the logon screen for the report. Which i dont want.

So, I think the setting of the logon info to the viewer is not working..

I have gone thru the forums, where they will instantiate the report document object, loop thru the tables and set the logon for each of them. but in my case, i dont load the report, but i get the infoobject from the query....

Please help

Former Member
Not what you were looking for? View more on this topic or Ask a question