cancel
Showing results for 
Search instead for 
Did you mean: 

Database Logon Failed in Drill Down reports

Former Member
0 Kudos

I am developing reports on Crystal Reports XI R2, VS.NET 2005 , SQL Server 2000, C#.

I am getting Database Logon Failed when I click on a drill down link in the report. It works if I click on the drill down link with in a minute. But if I wait for a minute and click on drill down, I am getting Database Logon Failed

Error in Crystal report viewer14

Object reference not set to an instance of an object

Any help would be greatly appreciated.

Thanks,

Sailu

Accepted Solutions (1)

Accepted Solutions (1)

Former Member
0 Kudos

Hi,

Please try setting database logon following way

reportDocObj.setdatabaselogon("Username","password")

and also try to add this code in post back event.

Thanks,

Prasad

Former Member
0 Kudos

should i put the post back in page load or where the report is generated

Former Member
0 Kudos

The above code should be written after the loading of report.

For example-

private void Page_Load(object sender, System.EventArgs e)

{

// Put user code to initialize the page here

if (!IsPostBack)

{

crReport.Load(Server.MapPath("CrystalReport1.rpt"));

ConnectionInfo crConn= new ConnectionInfo();

crConn.ServerName="D-3271-SQL";

crConn.DatabaseName="Northwind";

crConn.UserID="sa";

crConn.Password="sa";

Tables crTables=crReport.Database.Tables;

foreach(CrystalDecisions.CrystalReports.Engine.Table crTable in crTables)

{

TableLogOnInfo crLogoninfo=crTable.LogOnInfo;

crLogoninfo.ConnectionInfo =crConn;

crTable.ApplyLogOnInfo(crLogoninfo);

}

}

CrystalReportViewer1.ReportSource =crReport;

}

I hope this help

Regards

Amit

Edited by: Amit Singh on Aug 21, 2008 4:48 PM

Answers (0)