VS的Crystal Reports无法连接到SQL上的Windows 10

问题描述:

我对VS 2010(也尝试使用VS 2015)和SQL Server 2014的ODBC使用Crystal Reports SP 13.0.17。当我运行我的程序(传递外部报告),即使提供了正确的凭据,我也会获得数据库的登录对话框。如果我在对话框中重新输入用户名和密码,我会收到错误消息,提示用户名或密码不正确。VS的Crystal Reports无法连接到SQL上的Windows 10

这只发生在Windows 10上。如果我在Windows XP或Windows 7上运行它,它可以正常工作。

如果我在Crystal Reports中运行报表,该报表将连接到数据库。 ODBC连接与另一个不是Crystal的程序一起使用。

这是一个错误还是我错过了什么?

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(); 
} 

我得到了它通过使一个新的项目工作,并在复制我的代码。