执行水晶报告时出错

时间:2013-11-22 09:53:47

标签: c# sql winforms crystal-reports

我创建了一个水晶报告来显示我的月度销售详细信息,所以我创建了我的报告和数据集SQL连接,我的所有代码都正常工作但是当我给出我的2个日期时,它给了我一个错误:

  

“文件未发现异常未处理”,“无法加载文件或   程序集'file:/// C:\ Program Files(x86)\ SAP BusinessObjects \ Crystal   .NET Framework 4.0 \ Common \ SAP BusinessObjects Enterprise的报告   XI 4.0 \ win32_x86 \ dotnet1 \ crdb_adoplus.dll'或其依赖项之一。   系统找不到指定的文件。“

这是关于引用吗?

try
{
   CRPinvDate rpt = new CRPinvDate();
   //my report.
   SqlConnection myConnection = default(SqlConnection);
   SqlCommand MyCommand = new SqlCommand();
   SqlDataAdapter myDA = new SqlDataAdapter();
   sDate_DS myDS = new sDate_DS();
   //my dataset

   myConnection = new SqlConnection(cs);
   MyCommand.Connection = myConnection;
   MyCommand.CommandText = "select *  from Invoice_Info where Invoice_Date between @Invoice_Date1 and @Invoice_Date2";
   MyCommand.Parameters.Add("@Invoice_Date1", SqlDbType.DateTime, 30, "Invoice_Date").Value = DateFrom.Value.Date;
   MyCommand.Parameters.Add("@Invoice_Date2", SqlDbType.DateTime, 30, "Invoice_Date").Value = DateTo.Value.Date;

   MyCommand.CommandType = CommandType.Text;
   myDA.SelectCommand = MyCommand;
   myDA.Fill(myDS, "Invoice_Info");
   rpt.SetDataSource(myDS);

   crystalReportViewer1.ReportSource = rpt;
}
catch (Exception ex)
{
   MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);
}

1 个答案:

答案 0 :(得分:0)

卸载Crystal Report 从http://scn.sap.com/docs/DOC-7824

下载Service Pack 7

此文件http://downloads.businessobjects.com/akdlm/cr4vs2010/CRforVS_13_0_7.exe

安装crystal report安装.net framework 3.5& 4 安装下载的水晶报告,这将解决您的问题