我创建了一个xml
然后嵌套进报表,显示不出数据,各位看看应该如何去做。
代码如下:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.Web;
using CrystalDecisions.Shared;
namespace Weather.detect
{
/// <summary>
/// crytest 的摘要说明。
/// </summary>
public class crytest : System.Web.UI.Page
{
protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
private void Page_Load(object sender, System.EventArgs e)
{
//CrystalReport oRpt=new rptClient();
DataSet ds=new Dataset1();//xml数据源
SqlConnection CN = new SqlConnection("data source=localhost;initial catalog=erdata;user id=sa;password=sa");
CN.Open();
SqlDataAdapter da=new SqlDataAdapter("select * from thtemp",CN);
da.Fill(ds,"thtemp");//
rptClient oRpt=new rptClient();
oRpt.SetDataSource(ds.Tables[0]);
CrystalReportViewer1.ReportSource=oRpt;
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load); }
#endregion
}
}
然后嵌套进报表,显示不出数据,各位看看应该如何去做。
代码如下:
using System;
using System.Collections;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Web;
using System.Web.SessionState;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.HtmlControls;
using System.Data.SqlClient;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.Web;
using CrystalDecisions.Shared;
namespace Weather.detect
{
/// <summary>
/// crytest 的摘要说明。
/// </summary>
public class crytest : System.Web.UI.Page
{
protected CrystalDecisions.Web.CrystalReportViewer CrystalReportViewer1;
private void Page_Load(object sender, System.EventArgs e)
{
//CrystalReport oRpt=new rptClient();
DataSet ds=new Dataset1();//xml数据源
SqlConnection CN = new SqlConnection("data source=localhost;initial catalog=erdata;user id=sa;password=sa");
CN.Open();
SqlDataAdapter da=new SqlDataAdapter("select * from thtemp",CN);
da.Fill(ds,"thtemp");//
rptClient oRpt=new rptClient();
oRpt.SetDataSource(ds.Tables[0]);
CrystalReportViewer1.ReportSource=oRpt;
} #region Web 窗体设计器生成的代码
override protected void OnInit(EventArgs e)
{
//
// CODEGEN: 该调用是 ASP.NET Web 窗体设计器所必需的。
//
InitializeComponent();
base.OnInit(e);
}
/// <summary>
/// 设计器支持所需的方法 - 不要使用代码编辑器修改
/// 此方法的内容。
/// </summary>
private void InitializeComponent()
{
this.Load += new System.EventHandler(this.Page_Load); }
#endregion
}
}
解决方案 »
- 服务器端控件装换为input控件时遇到的问题
- GridView中显示的图片链接的问题
- 如何ds后取得select的记录数?
- 我现在有一个购物网站用asp做的,想把购物车换成.net开发
- 操作xml文件内容?
- 怎么样单击datagrid的一个模板列,弹出一个页面来。请教一段代码。谢谢?
- IsStartupScriptRegistered,缺少对象?忙了我一上午了(在线等待)
- 在一个类文件里能直接调用一个链接么?
- 错误信息为存储过程 PetBegin 指定的参数太多。
- asp.net+c#如何判断提交的数据是否是数字类型?
- .net连接ORACLE数据库出错了...
- ASP中的hidden在.NET里用什么相似的控件么?
你提供的数据集对rpt未生效。
应该如何给rpt重新提供数据源?
说明: 执行当前 Web 请求期间,出现未处理的异常。请检查堆栈跟踪信息,以了解有关该错误以及代码中导致错误的出处的详细信息。 异常详细信息: CrystalDecisions.CrystalReports.Engine.LogOnException: 登录失败。