首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > .NET > C# >

VS2010调用水晶报表调试时报错,该怎么解决

2013-12-13 
VS2010调用水晶报表调试时报错学习使用水晶报表,代码是从网上找的,private void Form1_Load(object sender

VS2010调用水晶报表调试时报错
学习使用水晶报表,代码是从网上找的,

        private void Form1_Load(object sender, EventArgs e)
        {
            using (SqlConnection conn = new SqlConnection("Server=127.0.0.1;Initial Catalog=StuMgWeb;User Id=sa;Password=000000;"))
            {
                conn.Open();
                using (SqlDataAdapter adpt = new SqlDataAdapter("select * from T_Student", conn))
                {
                    DataSet ds = new DataSet();
                    adpt.Fill(ds);
                    string reportPath = Application.StartupPath + @"\CrystalReport1.rpt";
                    DataTable dt = ds.Tables[0];
                    //MessageBox.Show(dt.Rows.Count.ToString());
                    ReportDocument rd = new ReportDocument();
                    rd.Load(reportPath);
                    ////List<T_Student> list = new List<T_Student>(dt.Rows.Count);
                    T_Student[] stus = new T_Student[dt.Rows.Count];
                    for (int i = 0; i < dt.Rows.Count; i++)
                    {
                        T_Student stu = new T_Student();
                        stu.Name = (string)dt.Rows[i]["Name"];
                        stu.Birthday = dt.Rows[i]["Birthday"].ToString();
                        stus[i] = stu;
                    }

                    rd.SetDataSource(stus);
                    this.crystalReportViewer1.ReportSource = rd;
                }
            }

调试时报错,如下:
托管调试助手“BindingFailure”在“E:\dotnet\水晶报表打印\水晶报表打印\bin\Debug\水晶报表打印.vshost.exe”中检测到故障。
其他信息: 显示名为“BusinessObjects.Licensing.KeycodeDecoder”的程序集未能加载到 ID 为 1 的 AppDomain 的“Load”绑定上下文中。错误的原因为: System.IO.FileNotFoundException: 未能加载文件或程序集“BusinessObjects.Licensing.KeycodeDecoder, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304”或它的某一个依赖项。系统找不到指定的文件。

且生成exe文件后,第一次打开exe文件失败,第二次打开时能成功弹出水晶报表预览界面,这是什么问题啊,整整调了一天了,哪位大牛帮下忙! VS2010 水晶报表 C#
[解决办法]
vs2010和水晶报表版不兼容,vs2010应该安装32位的水晶报表,可能安装了64位的水晶报表.
这个问题前段时间我刚遇到过.
[解决办法]
问题显示的是 程序集

热点排行