Click here to Skip to main content
16,020,345 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
please tell me how to bypass login in crystal report using C# and oracle 10g I am making a windpw based application
Posted
Comments
ZurdoDev 1-May-14 14:10pm    
You have to supply the credentials. I don't use Crystal so I can't tell you exactly but I believe you just supply the credentials in your connection string.

 
Share this answer
 
You can use below code to generate the report

private void IntReport(string rptPath, string strServerName, string strDataBase, string strUserName, string strPassword)
{

	try {
		ReportDocument crReportDoc = new ReportDocument();
		ConnectionInfo crpConnectionInfo = new ConnectionInfo();
		TableLogOnInfo crpTableLogonInfo = new TableLogOnInfo();
		Table tblCurrent = default(Table);
		Sections crSections = default(Sections);
		SubreportObject crSubreportObject = default(SubreportObject);
		ReportObjects crReportObjects = default(ReportObjects);

		ReportDocument crSubreportDocument = default(ReportDocument);

		_crReportDoc.Load(rptPath);
		crpConnectionInfo.AllowCustomConnection = true;
		crpConnectionInfo.ServerName = strServerName;
		crpConnectionInfo.DatabaseName = strDataBase;
		crpConnectionInfo.UserID = strUserName;
		crpConnectionInfo.Password = strPassword;

		foreach ( tblCurrent in _crReportDoc.Database.Tables) {
			crpTableLogonInfo = tblCurrent.LogOnInfo;
			crpTableLogonInfo.ConnectionInfo = crpConnectionInfo;
			tblCurrent.ApplyLogOnInfo(crpTableLogonInfo);
		}
		crSections = crReportDoc.ReportDefinition.Sections;

		foreach (Section crSection in crSections) {
			crReportObjects = crSection.ReportObjects;
			foreach (ReportObject crReportObject in crReportObjects) {
				if (crReportObject.Kind == ReportObjectKind.SubreportObject) {
					crSubreportObject = (SubreportObject)crReportObject;

					crSubreportDocument = crSubreportObject.OpenSubreport(crSubreportObject.SubreportName);

					foreach ( tblCurrent in crSubreportDocument.Database.Tables) {
						crpTableLogonInfo = tblCurrent.LogOnInfo;
						crpTableLogonInfo.ConnectionInfo = crpConnectionInfo;
						tblCurrent.ApplyLogOnInfo(crpTableLogonInfo);
					}

				}
			}
		}
		crReportDoc.VerifyDatabase();
	} catch (Exception ex) {
		throw ex;
	}
}
 
Share this answer
 
Comments
Member 10784192 4-May-14 13:57pm    
what will be the server name in oracle 10g
appoos 4-May-14 14:59pm    
download oracle odbc driver for windows from http://www.oracle.com/technetwork/indexes/downloads/index.html and create odbc to connect to the oracle datababse. Use the odbc name as server name in your code
Member 10784192 4-May-14 15:47pm    
means rather than connecting through oledb I have to connect with odbc.. but cna you please tell me the service name of oracle 10gxe ???
appoos 5-May-14 12:07pm    
If you are using oledb, this link will help you to solve the issue http://www.codeproject.com/Articles/28330/Using-Crystal-Report-with-Oracle-and-parametrized

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900