各位,请帮忙看看,为什么我的报表不显示数据啊!!???

问题描述

winform程序,连接access数据库,新建了一个dataset名称为tempDS,和一个datatabletempDT,新建了一张报表,tempreport.rdlc,在rempreport.rdlc里面添加了一个表,在button按钮中填写如下代码,运行后报表的表格中不显示数据,请各位给看看,谢谢了:using(OleDbConnectioncon=newOleDbConnection(constr)){//constr前面已经定义OleDbCommandcmd=newOleDbCommand("select*fromtodaytemp",con);DataSetds=newtempDS();con.Open();OleDbDataReaderdr=cmd.ExecuteReader();ds.Tables[0].Load(dr);reportViewer1.LocalReport.ReportEmbeddedResource="Door.tempreport.rdlc";ReportDataSourcerds=newReportDataSource();rds.Name="tempDS_tempDT";rds.Value=ds.Tables[0];reportViewer1.LocalReport.DataSources.Add(rds);reportViewer1.RefreshReport();}相关图片如下:

解决方案

解决方案二:
在线等!谢谢大家!
解决方案三:
都去吃饭了??
解决方案四:
该回复于2011-12-12 09:52:24被版主删除
解决方案五:
我在.Net里用的水晶报表,跟你一样,采用PUSH模式.参考阿泰的范例://设置数据源信息DataSet1ds1=newDataSet1();OleDbDataAdapterda=newOleDbDataAdapter();Stringconnstr="Provider=Microsoft.Jet.OLEDB.4.0;DataSource="+Server.MapPath("~/app_data/test.mdb")+";";OleDbConnectioncn=newOleDbConnection(connstr);//获取记录集,注意,最终获取的记录集需要与xsd的结构一致!//即使是子报表,也是同样的方法,因为这还是那个Dataset!da=newOleDbDataAdapter("SELECTEmployeeId1asEmployeeId,Hisdogname1asHisdogFromforsubreport1",cn);//注意表名,需要与xsd中的一致!此处尽量不要忽略。da.Fill(ds1,"forsubreport");da=newOleDbDataAdapter("SELECTEmployeeId1asEmployeeId,EmployeeName1asEmployeeNameFromEmployee1",cn);da.Fill(ds1,"Employee");da=newOleDbDataAdapter("SELECTProductId1asProductId,ProductName1asProductNameFromProduct1",cn);da.Fill(ds1,"Product");da=newOleDbDataAdapter("SELECTEmployeeId1asEmployeeId,ProductId1asProductId,saledate1assaledate,num1asnumFromsales1",cn);da.Fill(ds1,"Sales");//以上为数据部分,与报表无关//-----------------------------------------------------------//以下为报表部分//使用报表对象加载报表ReportDocumentmyReport=newReportDocument();stringreportPath=Server.MapPath("~/app_data/crystalreport1.rpt");myReport.Load(reportPath);//CrystalReport1myReport=newCrystalReport1();//绑定数据集,注意,一个报表用一个数据集。myReport.SetDataSource(ds1);CrystalReportViewer1.ReportSource=myReport;
解决方案六:
你对照一下吧.我觉得WinForm与Web的原理应该是一样的.如果还不能解决问题.去查一下阿泰的博客吧.希望对你有所帮助.
解决方案七:
都去吃饭了??
解决方案八:
谢谢,我感觉自己也是这样写的啊
解决方案九:
到底那里出问题了啊?各位,走过路过,给看看呗
解决方案十:
没人顶,自己顶,郁闷了
解决方案十一:
1、确保数据库表todaytemp与DataTabletempDT数据结构一致(字段名与类型)2、修改你的代码如下(改动部分已用红色字体标出):using(OleDbConnectioncon=newOleDbConnection(constr)){//constr前面已经定义OleDbCommandcmd=newOleDbCommand("select*fromtodaytemp",con);tempDSds=newtempDS();con.Open();OleDbDataReaderdr=cmd.ExecuteReader();ds.tempDT.Load(dr);reportViewer1.LocalReport.ReportEmbeddedResource="Door.tempreport.rdlc";ReportDataSourcerds=newReportDataSource();rds.Name="tempDS_tempDT";rds.Value=ds.tempDT;reportViewer1.LocalReport.DataSources.Add(rds);reportViewer1.RefreshReport();}
解决方案十二:
引用10楼luols的回复:

1、确保数据库表todaytemp与DataTabletempDT数据结构一致(字段名与类型)2、修改你的代码如下(改动部分已用红色字体标出):using(OleDbConnectioncon=newOleDbConnection(constr)){//constr前面已经定义OleDbCommandcmd=newOleDbCommand("sel……

谢谢老大,我去试试
解决方案十三:
引用10楼luols的回复:

1、确保数据库表todaytemp与DataTabletempDT数据结构一致(字段名与类型)2、修改你的代码如下(改动部分已用红色字体标出):using(OleDbConnectioncon=newOleDbConnection(constr)){//constr前面已经定义OleDbCommandcmd=newOleDbCommand("sel……

老大,还是不现实数据啊,todaytemp与DataTabletempDT数据结构我又核对了一遍,都一致的,表中的id是长整型,tempDT中int32、int64我都试了,其他字段都是string。如果我在reportViewer1.LocalReport.DataSources.Add(rds);前面加上一句reportViewer1.LocalReport.DataSources.clear();报表则显示:尚未为数据源DataSet1提供数据源示例”这个DataSet1是在往报表里拖入table控件的时候,出现的选择数据源界面中的数据源名称。
解决方案十四:
你设断点跟踪一下ds.tempDT有没数据
解决方案十五:
引用13楼luols的回复:

你设断点跟踪一下ds.tempDT有没数据

有数据的,this.dataGridView1.DataSource=ds.tempDT;这个datagridview能够完好显示数据
解决方案:
不要放在using里面,using后数据都被释放了
解决方案:
引用15楼luols的回复:

不要放在using里面,using后数据都被释放了

还是不行,郁闷啊!

时间: 2024-07-31 01:22:36

各位,请帮忙看看,为什么我的报表不显示数据啊!!???的相关文章

没有数据-C#水晶报表不显示数据?

问题描述 C#水晶报表不显示数据? 数据库是sqlite,代码如下,什么推模式拉模式的不懂呀.. SQLiteConnection conn = new SQLiteConnection("Data Source=equipment.db"); conn.Open(); SQLiteCommand comm = new SQLiteCommand("select eqName,model,danwei,count,price,total from storeA",

struts+jasperreport做报表,显示数据为空,条数正确

问题描述 struts+jasperreport做报表,显示数据为空,条数正确 struts+jasperreport做报表,显示数据为空或0,条数正确,不知道是代码问题还是ireport设置问题! action代码: public String taxDeclaration() { rptApd3s = taxDeclareManager.getRptApd3(rptRcdID); return "success_rptApd3"; } strutus.xml代码: /jasperr

新人求助!winform中报表不显示数据,请大神进来解答

问题描述 新人对winform的报表不是很熟悉.添加了数据源和数据集,然后用reportviewer手动绑定了rdlc报表.点击运行结果只有字段名,没有数据.Access数据库里是有数据的. 解决方案 解决方案二:没用过ReportViewer,你可以参考

dom优化 js优化-写了个table合并、计算合计的js,数据多的话IE下效率很低,请帮忙看看

问题描述 写了个table合并.计算合计的js,数据多的话IE下效率很低,请帮忙看看 如题,实际项目中数据有9000条,IE下合并需要30秒,想优化一下但不知道怎么下手,请高手给看看,代码在(http://runjs.cn/detail/14ax6nfo),谢谢 解决方案 什么也没有看到,这题是道猜谜题?

技术-求大神帮忙分许润乾报表或html开发报表功能的优劣不同,谢谢

问题描述 求大神帮忙分许润乾报表或html开发报表功能的优劣不同,谢谢 现在需要开发一个报表模块,有两种方式: 1.调用其他熊也开发好的润乾报表接口,但是本人不会使用润乾报表: 2.直接使用html相关技术进行开发 ,请大神们评价一下这两种方式的优劣,谢谢 了! 解决方案 润乾报表是一个纯JAVA的企业级 报表工具,如果想用就去学吧. 当然,如果你熟悉其中的一个,就不用再考虑,直接使用熟悉的.如果都不熟悉,建议你选择使用方广的,如 HTML,这样网上查资料方便一些.除非你能得到润乾报表的技术支持

c c++编程-请帮忙看看这个题目,真心不知如何去写

问题描述 请帮忙看看这个题目,真心不知如何去写 Xiangqi Time Limit:?1000MS Memory Limit:?65536K Description Xiangqi is one of the most popular two-player board games in China. The game represents a battle between two armies with the goal of capturing the enemy's "general&qu

datagridview-Datagridview 不能插入多行,每次只插入一行,请帮忙分析代码问题所在,谢谢。

问题描述 Datagridview 不能插入多行,每次只插入一行,请帮忙分析代码问题所在,谢谢. Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click Dim mycn As New SqlClient.SqlConnection Dim mycom As New SqlClient.SqlCommand mycn.Connection

上传ftp出错 请帮忙-上传ftp出错,刚刚提问写错了,请帮忙

问题描述 上传ftp出错,刚刚提问写错了,请帮忙 strm = reqFTP.GetRequestStream(); strm.Write(buff, 0, buff.Length); strm.Dispose(); strm.Close(); 到了strm.Dispose();时就报错: The remote server returned an error: (550) File unavailable (e.g., file not found, no access). 解决方案 You

鼠标触发调用方法clearAuto如何停止切换?请帮忙指教,谢谢!

问题描述 鼠标触发调用方法clearAuto如何停止切换?请帮忙指教,谢谢! 鼠标触发调用方法clearAuto如何停止切换? js 中的代码如下: var n=0; var showNum = document.getElementById("num"); function Mea(value){ n=value; setBg(value); plays(value); } function setBg(value){ for(var i=0;i<3;i++){ if(valu