提示报表加载失败.
代码很简单如下:
//函数部分
using System.Data.SqlClient;
using System.Text.RegularExpressions;
using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
        #region  创建报表对象的方法
        public ReportDocument GetCrystalReports(string str_reportname, String str_sqltext)
        {
            ReportDocument tempreportdocument = new ReportDocument();
            string str_reportpath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
            str_reportpath += @"\crystal\" + str_reportname;
            tempreportdocument.Load(str_reportpath);
            tempreportdocument.DataDefinition.RecordSelectionFormula = str_sqltext;
            return tempreportdocument;
        }
        #endregion
代码部分        驾校数据管理.PublicFunction MyFunction = new 驾校数据管理.PublicFunction();
        ReportDocument MyDocument = new ReportDocument();
        private void button2_Click(object sender, EventArgs e)
        {
            MySql1 = "select 报名日期,学员学号,姓名,身份证号,选择教练,笔试时间 from 学员信息表 where 笔试时间>='" + DateTime.Parse(textBox1.Text).ToShortDateString() + "' and 笔试时间<'" + DateTime.Parse(textBox2.Text).AddDays(1).ToShortDateString() + "' and 第一教练 is null and 选择教练 is not null order by 选择教练,笔试时间;";
            MyData = new DataSet();
            MyData = MyFunction.GetSqlDataSet(MySql1, MyTable);
            this.MySql1 = "{学员信息表.学员学号}>='0'";
            //调用MyFunction对象的方法返回报表
            MyDocument = MyFunction.GetCrystalReports("CrystalReportfenpei.rpt", MySql1);
            //定义报表对象的数据源
            MyDocument.SetDataSource(MyData.Tables[MyTable].DefaultView);
            //在报表视图控件上显示报表内容
            this.crystalReportViewer1.ReportSource = MyDocument;
        }
push方式是通过在解决方案资源管理器中添加了一个DATASET数据集.数据集没问题,用的是SQL的IP.用户名:密码:连接的.
与报表有关的较大的代码都在这.头痛了两天了没解决求助.用PULL方式做的报表打包后能运行.但每次打开都要办理数据库密码.