0
votes

I'm using Crystal Reports SP 13.0.17 for VS 2010 (also tried with VS 2015) and ODBC for SQL Server 2014. When I run my program (passing an external report), I get a login dialog for the database, even though the correct credentials are supplied. If I retype the username and password in the dialog box, I get an error saying the username or password aren't correct.

This only happens on Windows 10. If I run it on Windows XP or Windows 7, it works correctly.

The report connects to the database if I run it in Crystal Reports. The ODBC connection works with another program that isn't Crystal.

Is this a bug or am I missing something?

ReportDocument cryRpt = new ReportDocument();

cryRpt.Load(strFilename);
cryRpt.PrintOptions.PrinterName = strPrinterName;
this.Name = this.Text = Path.GetFileNameWithoutExtension(strFilename);
cryRpt.SetDatabaseLogon(strDBUser, strDBPwd, strDBServer, strDBDatabase);

cryRpt.RecordSelectionFormula = strSelForm;

foreach (var pair in dctParams)
try
{
    cryRpt.SetParameterValue(pair.Key, pair.Value);
}
catch (Exception ex)
{
    MessageBox.Show("Parameter: " + pair.Key + ", Value: " + pair.Value.ToString() + ", Type: " + pair.Value.GetType() + ", was not passed correctly", "Error");
}

crystalReportViewer1.ViewTimeSelectionFormula = strSelForm;
crystalReportViewer1.SelectionFormula = strSelForm;
crystalReportViewer1.ShowExportButton = bShowExport;
crystalReportViewer1.ShowPrintButton = bShowPrint;
crystalReportViewer1.ShowParameterPanelButton = bShowParam;
crystalReportViewer1.ShowGroupTreeButton = bShowGroup;
if(!bShowParamPanel)
    crystalReportViewer1.ToolPanelView = CrystalDecisions.Windows.Forms.ToolPanelViewType.None;

crystalReportViewer1.ReportSource = cryRpt;

if (bShowForm)
{
    if (!this.ShowInTaskbar)
        this.ShowInTaskbar = true;

    if (this.WindowState == FormWindowState.Minimized)
        this.WindowState = FormWindowState.Maximized;
    crystalReportViewer1.Refresh();
    if (bPrint) cryRpt.PrintToPrinter(1, false, 0, 0);
}
else
{
    cryRpt.PrintToPrinter(1, false, 0, 0);
    this.Close();
}
1

1 Answers

0
votes

I got it to work by making a new project and copied my code in.