Symptom
How to pass Database logon information to a Crystal report which uses Oracle Service connectivity, using .NET SDK?
Environment
- SAP Crystal Reports, developer version for Microsoft Visual Studio.
- Connectivity: Oracle Service using Oracle Native Client
- Microsoft Visual Studio 2010
Resolution
Check Oracle Service name by following below steps.
- Go to Start > All Programs > Oracle > Configuration and Migration Tools > Net Manager
- Expand Local
- Expand Service Naming
- Select service name and use the same in code.
Here is C# code for passing Database credential to a crystal report which uses Oracle Service connectivity through Oracle Native Client:
rd=newReportDocument();
rd.Load(Server.MapPath("CrystalReport1.rpt"));
CrystalDecisions.Shared.ConnectionInfo boConnectionInfo = new ConnectionInfo();
boConnectionInfo.ServerName ="Enter your oracle service name";
boConnectionInfo.UserID ="Enter your User name";
boConnectionInfo.Password ="Enter your password";
foreach(CrystalDecisions.CrystalReports.Engine.Table boTable inrd.Database.Tables)
{
CrystalDecisions.Shared.TableLogOnInfoboTableLogOnInfo = boTable.LogOnInfo;
boTableLogOnInfo.ConnectionInfo = boConnectionInfo;
boTable.ApplyLogOnInfo(boTableLogOnInfo);
}
CrystalReportViewer1.ReportSource = rd;
See Also
SAP Note: 1432440 How to change datasource location and table location of Crystal Reports report at runtime using RAS .NET SDK for Oracle Native Driver
Keywords
oracle native client; DBlogon; database logon credential , KBA , BI-DEV-NET , BI Software Development Kits (SDKs) - .NET or Other , How To
Product
SAP Crystal Reports, developer version for Microsoft Visual Studio