0
votes

My code to load a .rpt file (crystal report) from an exe file (C#)

ReportDocument cryRpt = new ReportDocument();
cryRpt.Load(strRptPath);

cryRpt.DataSourceConnections.Clear();
cryRpt.DataSourceConnections[0].SetConnection(m_strServerName, m_strDBName, false);
cryRpt.DataSourceConnections[0].IntegratedSecurity = true;
for (int i = 0; i < arrFields.Count(); i++)
{
    cryRpt.SetParameterValue(arrFields[i], arrValues[i]);
}
cryRpt.RecordSelectionFormula = m_strFormula;

rptViwer_epd.ReportSource = m_cryRpt;
rptViwer_epd.SelectionFormula = m_Report.RecordSelectionFormula;
rptViwer_epd.Refresh();

Why the "Database login" dialog is shown, with empty and disabled Database and server name fields?

1

1 Answers

0
votes

based on my experience database login could mean anything, (yes it doesn't specify the problem, nor visual studio can debug it as well).

what you need to check, whether all fields mentioned on .rpt are well supplied. ex, in case you have a table inside, and it doesn't get populated, it will prompt that login form. else, you need to investigate further for any declared item.