rdlc砖取出现尚未为数据源“ModelProCity_ModelProvCity”提供数据源实例。

zhoulihong_1986 2009-12-14 04:40:03
using System;
using System.Collections;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using BLL;
using Microsoft.Reporting.WebForms;
namespace Web
{
public partial class ModelProvinceResult : System.Web.UI.Page
{
public DataSet dDs = new DataSet();
protected void Page_Load(object sender, EventArgs e)
{
if (Page.IsPostBack == false)
{
ModelProvince();
this.lbl_datetime.Text = "从" + Request["sStarttime"].ToString() + "到" + Request["sEndtime"].ToString();
}
}

public DataSet ModelProDataSet()
{
string sStarttime = Request["sStarttime"].ToString();
string sEndtime = Request["sEndtime"].ToString();
string sProvince = Request["sProvince"].ToString();
string sModeName = Request["sModeName"].ToString();
B_Sms bSms = new B_Sms();

dDs = bSms.ModelProvince(sStarttime, sEndtime, sProvince, sModeName);
return dDs;
}
/// <summary>
/// 按时间机型省份查询出来的结果
/// </summary>
public void ModelProvince()
{
ModelProDataSet();
if (dDs.Tables[0].Rows.Count != 0)
{
this.ReportViewer1.LocalReport.ReportPath = "ReportOperator/ModelProvince.rdlc";
this.ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("modpromyds",
this.dDs.Tables[0]));
this.ReportViewer1.DataBind();
this.lbl_dataMess.Text = "";
}
else
{
this.ReportViewer1.Visible = false;
this.lbl_dataMess.Text = "没有记录!";
}
}

protected void btn_TotalImage_Click(object sender, EventArgs e)
{
///统计图形
this.btn_TotalImage.Visible = true;

this.btn_PrintReport.Visible = true;
this.btn_cancle.Visible = true;
this.btn_windowclose.Visible = true;
this.DrpDown_Image.Visible = true;
this.ReportViewer1.Reset();
ModelProDataSet();
this.ReportViewer1.LocalReport.ReportPath = "ReportOperator/ModProColumn.rdlc";
this.ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("myds",
this.dDs.Tables[0]));
this.ReportViewer1.DataBind();

}

protected void btn_cancle_Click(object sender, EventArgs e)
{
///取消
Response.Redirect("ModelProvince.aspx");

}

protected void DrpDown_Image_SelectedIndexChanged(object sender, EventArgs e)
{
///下拉列表变化图表变化
ModelProDataSet();
this.ReportViewer1.Reset();
string stype = this.DrpDown_Image.SelectedItem.Text;
if (stype.Equals("柱状累积图"))
{
this.ReportViewer1.LocalReport.ReportPath = "ReportOperator/ModProColumn.rdlc";
}
else if (stype.Equals("柱状比较图"))
{
this.ReportViewer1.LocalReport.ReportPath = "ReportOperator/ModProColCompare.rdlc";
}
else if (stype.Equals("折线图"))
{
this.ReportViewer1.LocalReport.ReportPath = "ReportOperator/ModProLine.rdlc";
}
else if (stype.Equals("曲线图"))
{
this.ReportViewer1.LocalReport.ReportPath = "ReportOperator/ModProCurve.rdlc";
}
else if (stype.Equals("面积图"))
{
this.ReportViewer1.LocalReport.ReportPath = "ReportOperator/ModProArea.rdlc";
}
else if (stype.Equals("面积比例图"))
{
this.ReportViewer1.LocalReport.ReportPath = "ReportOperator/ModProArearat.rdlc";
}

this.ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("myds",
this.dDs.Tables[0]));
this.ReportViewer1.DataBind();
}

protected void btn_PrintReport_Click1(object sender, EventArgs e)
{
///打印报表
this.DrpDown_Image.Visible = false;
this.btn_cancle.Visible = false;
this.btn_PrintReport.Visible = false;
this.btn_TotalImage.Visible = false;
this.btn_windowclose.Visible = true;

this.ReportViewer1.Reset();
ModelProvince();
}

protected void btn_windowclose_Click(object sender, EventArgs e)
{
///关闭窗口
this.btn_windowclose.Visible = false;
this.btn_cancle.Visible = true;
this.btn_PrintReport.Visible = true;
this.btn_TotalImage.Visible = true;
this.DrpDown_Image.Visible = true;
this.DrpDown_Image.Visible = false;
this.ReportViewer1.Reset();
ModelProvince();
}

protected void ReportViewer1_Drillthrough(object sender, DrillthroughEventArgs e)
{

LocalReport lp = (LocalReport)e.Report;
string province = lp.GetParameters()["prov"].Values[0].Trim();
string types = lp.GetParameters()["types"].Values[0].Trim();

if (types == "省份")
{
lp.DataSources.Clear();
this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("ModelProCity_ModelProvCity", ModelProvCityDataTable(province)));

}
else
{

lp.DataSources.Clear();
this.ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("ModelProvRound_ModelProvRound", ModelProvRoundDataTable(province)));

}


}
public DataTable ModelProvRoundDataTable(string Province)
{
B_Sms bSms = new B_Sms();
return bSms.ModeProvinceRound(Province).Tables[0];
}
public DataTable ModelProvCityDataTable(string Province)
{

B_Sms bSms = new B_Sms();
return bSms.ModeProvinceCity(Province).Tables[0];
}



}
}



其中报错
protected void ReportViewer1_Drillthrough(object sender, DrillthroughEventArgs e)
{

LocalReport lp = (LocalReport)e.Report;
string province = lp.GetParameters()["prov"].Values[0].Trim();
string types = lp.GetParameters()["types"].Values[0].Trim();

if (types == "省份")
{
lp.DataSources.Clear();
this.ReportViewer1.LocalReport.DataSources.Add(new ReportDataSource("ModelProCity_ModelProvCity", ModelProvCityDataTable(province)));

}
else
{

lp.DataSources.Clear();
this.ReportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WebForms.ReportDataSource("ModelProvRound_ModelProvRound", ModelProvRoundDataTable(province)));

}这里保存报“尚未为数据源“ModelProCity_ModelProvCity”提供数据源实例。”
...全文
749 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
qq4004229 2011-02-21
  • 打赏
  • 举报
回复
楼主是个不厚道的人
jervisbubu 2010-08-24
  • 打赏
  • 举报
回复
解决了不说怎么解决的
zhoulihong_1986 2009-12-16
  • 打赏
  • 举报
回复
问题解决了
「已注销」 2009-12-16
  • 打赏
  • 举报
回复
解决了,记得结贴啊
wuyq11 2009-12-15
  • 打赏
  • 举报
回复
名称和rdlc报表设计时的名称不一样造成
「已注销」 2009-12-15
  • 打赏
  • 举报
回复
你的前台注册这个钻取事件没有
lyboyc 2009-12-15
  • 打赏
  • 举报
回复
ModelProvince() 方法里要给ModelProCity_ModelProvCity绑顶数据源。
用了几个数据源,后台就要绑几个,不管是在ModelProvince()方法里还是钻取事件ReportViewer1_Drillthrough里
代码下载链接: https://pan.quark.cn/s/a4b39357ea24 Books-Management-System C语言期末大作业——图书信息管理系统(C语言,单链表) 题目内容 ========== 1.系统名称 ------- 六、图书信息管理程序 2.基本要求 ------- 使用链表保存图书信息,每个节点要求包含图书的编号、书名、作者、购买日期和价格信息; 可以对当前图书数据库进行增加、删除操作,并实现按图书编号进行查询; 系统完成后应实现类似下图所示界面; 完成内容 ========== 1.基本任务 ----------- 使用链表保存图书信息: 图书编号; 图书名; 图书作者; 图书库存数量; 图书价格; 可对链表进行CRUD操作: 有Shell界面 2.拓展任务 ----------- 使用Git管理代码; 推送到上开源: 将代码分模块开发; 查询功能扩展根据书名和作者查询 有一定的异常管理机制; 设计内容 ========== 1.代码结构设计 --------------- 2.系统模块设计 --------------- 3.数据结构设计 ---------------- 3.1.链表: 结构体标志:Node 结构体声明变量:Book 结构体成员列表: 结构体代码: 4.算法设计 ------------ 4.1.冒泡排序法: 时间复杂度:$$O\left( n^{2} \right)$$; 算法原理: 比较相邻的元素。 如果第一个比第二个大,就交换他们两个; 对每一对相邻元素做同样的工作,从开始第一对到结尾的最后一对。 在这一点,最后的元素应该会是最大的数; 针对所有的元素重复以上的步骤,除了最后一个; 持续每次对越来越少...

4,818

社区成员

发帖
与我相关
我的任务
社区描述
.NET技术 图表区
社区管理员
  • 图表区社区
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧