我爲Windows項目創建了一些Crystal Reports。當我在Visual Studio上運行它們時,它們運行良好。 (我正在使用VS 2010)。但是,在我創建安裝項目並在客戶端PC上安裝軟件後,他們無法工作。我收到以下錯誤:創建項目設置後,Crystal報表無法正常工作
http://tistus.srilanka-erickson.com/errors.html
繼顯示的是我用來加載水晶報表按鈕點擊事件代碼:一是儘量條款已被用於定製輸入註冊報告,同時第二try子句已用於手動創建與報表的數據庫連接。第三次嘗試子句僅用於加載報告。
private void buttonGenerateSecExportRpt_Click(object sender, EventArgs e)
{
CrystalDecisions.CrystalReports.Engine.ReportDocument cryRpt = new CrystalDecisions.CrystalReports.Engine.ReportDocument();
if (comboBoxSecPlateType.Text != "" && comboBoxSecExPlateBrand.Text != "")
{
try
{
dtFrom.Format = DateTimePickerFormat.Custom;
string periodfrom = dtFrom.Value.ToString("yyyy/MM/dd");
dtTo.Format = DateTimePickerFormat.Custom;
string periodto = dtTo.Value.ToString("yyyy/MM/dd");
//cryRpt.VerifyDatabase();
string fullPath = "..\\..\\SecondaryPlateExportReport.rpt";
cryRpt.Load(fullPath);
cryRpt.SetParameterValue("dateFromChecked", dtFrom.Checked);
cryRpt.SetParameterValue("dateToChecked", dtTo.Checked);
cryRpt.SetParameterValue("dtPeriodFrom", periodfrom);
cryRpt.SetParameterValue("dtPeriodTo", periodto);
cryRpt.SetParameterValue("PlateType", comboBoxSecPlateType.Text.Trim());
cryRpt.SetParameterValue("PlateBrand", comboBoxSecExPlateBrand.Text.Trim());
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
try
{
DbConnectionInfo.SetConnectionString(ConfigurationManager.ConnectionStrings["con"].ToString());
TableLogOnInfo logOnInfo;
ConnectionInfo connectionInfo;
foreach (Table table in cryRpt.Database.Tables)
{
logOnInfo = table.LogOnInfo;
connectionInfo = logOnInfo.ConnectionInfo;
// Set the Connection parameters.
connectionInfo.DatabaseName = DbConnectionInfo.InitialCatalog;
connectionInfo.ServerName = DbConnectionInfo.ServerName;
if (!DbConnectionInfo.UseIntegratedSecurity)
{
connectionInfo.Password = DbConnectionInfo.Password;
connectionInfo.UserID = DbConnectionInfo.UserName;
}
else
{
connectionInfo.IntegratedSecurity = true;
}
table.ApplyLogOnInfo(logOnInfo);
}
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
try
{
crystalReportViewerSecEx.ReportSource = cryRpt;
crystalReportViewerSecEx.Refresh();
}
catch (Exception ex)
{
MessageBox.Show(ex.ToString(), "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
else
{
MessageBox.Show("Please select both Plate Type and the Brand to Generate the Report!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}
}
我想在客戶端PC上部署軟件後使Crystal Reports工作。任何建議將不勝感激!