当前位置: 代码迷 >> .NET报表 >> 水晶报表下提示“没有有效的报表源”解决方案
  详细解决方案

水晶报表下提示“没有有效的报表源”解决方案

热度:8808   发布时间:2013-02-25 00:00:00.0
水晶报表下提示“没有有效的报表源”
vs2010 下使用水晶报表 后台绑定代码如下

C# code
 private ReportDocument myArea;        protected void Page_Load(object sender, EventArgs e)        {            if (!Page.IsPostBack)            {                Initialize();            }        }        private void Initialize()        {            CRBind();        }        private void CRBind()        {            DataSet ds = new DataSet();            string strSql = "select p.name as Province,c.name as City, a.name as Area,a.code as ZIP from province p left join city c on p.code=c.fid left join area a on c.code=a.fid";            using (SqlConnection Conn = new SqlConnection(ConfigurationManager.ConnectionStrings["AreaDB"].ConnectionString))            {                SqlDataAdapter sda = new SqlDataAdapter(strSql, Conn);                sda.Fill(ds,"Area");            }                                    string filePath = Server.MapPath("CrystalReportPush.rpt");            myArea = new ReportDocument();            myArea.Load(filePath);            myArea.SetDataSource(ds.Tables["Area"]);            CrystalReportViewer1.ReportSource = myArea;            CrystalReportViewer1.DataBind();                  }    }


页面就一个CrystalReportViewer 控件 ,有一个 ds.xsd的数据集文件 。

ds.table["Area"]是一个全国行政区划的表 ,字段在下边语句中。
select p.name as Province,c.name as City, a.name as Area,a.code as ZIP from province p left join city c on p.code=c.fid left join area a on c.code=a.fid

运行后显示第一页,北京的数据,其他数据不显示,翻页就提示 “没有有效的报表源”。看了很多问题提示什么的,都没有解决。初次接触水晶报表,彻底无解了。

附webconfig文件引用
XML code
        <compilation debug="true" targetFramework="4.0">            <assemblies>                <add assembly="CrystalDecisions.Web, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>                <add assembly="CrystalDecisions.Shared, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>                <add assembly="log4net, Version=1.2.10.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>                <add assembly="CrystalDecisions.ReportSource, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>                <add assembly="CrystalDecisions.ReportAppServer.Controllers, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>                <add assembly="CrystalDecisions.ReportAppServer.DataDefModel, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>                <add assembly="CrystalDecisions.CrystalReports.Engine, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692FBEA5521E1304"/>                <add assembly="CrystalDecisions.ReportAppServer.ClientDoc, Version=13.0.2000.0, Culture=neutral, PublicKeyToken=692fbea5521e1304"/>                <add assembly="Microsoft.Build.Framework, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/>                <add assembly="System.Management, Version=4.0.0.0, Culture=neutral, PublicKeyToken=B03F5F7F11D50A3A"/></assemblies></compilation>


------解决方案--------------------------------------------------------
我也没玩儿过水晶报表
搜搜水晶报表翻页
------解决方案--------------------------------------------------------
探讨

又不行了!

------解决方案--------------------------------------------------------
简单案例

请查看报表路径是否正确

请检查报表引用

请查看报表是否注册
  相关解决方案