asp.net做做报表的方法

这是以个c#做的报表例子,      //打开连接      conReport.Open();      //准备连接对象以把获取的数据放入数据集      cmdReport.CommandType = CommandType.Text;      cmdReport.Connection = conReport;      cmdReport.CommandText = "Select TOP 5 * FROM Products Order By ProductName";      //从命令对象中读取数据      drReport = cmdReport.ExecuteReader();      //有了ADO.NET,可把读取来的数据直接加载到数据集中      dsReport.Tables[0].Load(drReport);      //关闭读取及连接      drReport.Close();      conReport.Close();      //为查看器提供本地报表数据 this.reportViewer1.LocalReport.ReportEmbeddedResource =      "报表问题.rptProductList.rdlc";      //准备报表数据源      ReportDataSource rds = new ReportDataSource();      rds.Name = "dsProduct_dtProductList";      rds.Value = dsReport.Tables[0]; this.reportViewer1.LocalReport.DataSources.Add(rds);      //加载报表查看器 this.reportViewer1.RefreshReport();    }    catch (Exception ex)    {      //显示错误信息      MessageBox.Show(ex.Message);    }    finally    {      //检查连接是否仍然打开,如果是,关闭它。      if (conReport.State == ConnectionState.Open)      {        conReport.Close();      }
评论
成就一亿技术人!
拼手气红包6.0元
还能输入1000个字符
 
红包 添加红包
表情包 插入表情
 条评论被折叠 查看
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值