dataset绑定水晶报表问题 我把一个dataset绑定到一个报表时出错。 提示 该报表不包含表,既然我把dataset绑定到报表中,难道这报表中还要包含表吗?有人说 要给报表增加字段名,如果我给他增加字段名,我还要动态绑定干吗?即使增加字段名,那该如何加呢? 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 转换类型? 什么意思?说具体点。俺 菜鸟+新手我就是要把它做gridview那样,通过SQL查询语句绑定数据。 呵呵,这个可不是一下能说清的哦.大概就是你要定义一个ttx文件,字段与你的ds一致.然后你再拖到rpt就OK.当然你在cs中还得写代码. ReportDocument poRpt = new ReportDocument(); poRpt.Load(Server.MapPath("CrystalReport1.rpt")); SqlDataAdapter sda = new SqlDataAdapter(); string sql = "select * from DZLJ_03"; SqlConnection con = new SqlConnection(Custom.SqlConnectionString); con.Open(); sda.SelectCommand = new SqlCommand(sql,con); sda.SelectCommand.ExecuteNonQuery(); con.Close(); DataSet ds = new DataSet(); sda.Fill(ds, "RepairRecord"); poRpt.SetDataSource(ds); this.CrystalReportViewer1.ReportSource = poRpt;我是这样绑定的,我也不知道哪儿出了问题。请指教,谢谢!! 為什么不用report service 呢,這是vs 2005自帶,作用和水晶一樣哦 我按照有人说的把字段名拖进去,发现根本不需要dataset绑定就显示数据啦!! 高手们,帮忙想象办法,谢谢!!!!!!!! 加一行:poRpt.SetDataSource(myData);myData是你的数据集 加一句this.CrystalReportViewer1.DataBand();试试看 this.CrystalReportViewer1.DataBind(); 你把con.Close();放在sda.Fill(ds, "RepairRecord"); 后面 哥们 不是这个原因吧DataAdapter 是离线模式数据库操作! 还是谢谢你的回答!! 我会这样写 ReportDocument poRpt = new ReportDocument(); poRpt.Load(Server.MapPath("CrystalReport1.rpt")); string sql = "select * from DZLJ_03"; SqlConnection con = new SqlConnection(Custom.SqlConnectionString); SqlCommand command = new SqlCommand(sql,con); SqlDataAdapter sda = new SqlDataAdapter(command); DataSet ds = new DataSet(); sda.Fill(ds); poRpt.SetDataSource(ds); this.CrystalReportViewer1.ReportSource = poRpt; 后面我换了个写法 SqlDataAdapter sda = new SqlDataAdapter(); string sql = "select * from DZLJ_03"; SqlConnection con = new SqlConnection(Custom.SqlConnectionString); con.Open(); sda.SelectCommand = new SqlCommand(sql, con); sda.SelectCommand.ExecuteNonQuery(); con.Close(); DataSet ds = new DataSet(); sda.Fill(ds, "RepairRecord"); CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport.rpt")); //注意此处必需指明Dataset中的表的名称,否则会提示“您请求的报表需要更多信息.” CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]); CrystalReportSource1.DataBind(); CrystalReportViewer1.ReportSource = CrystalReportSource1; CrystalReportViewer1.DataBind(); CrystalReportViewer1.BestFitPage = true; CrystalReportViewer1.Width = Unit.Pixel(400);还是报 该报表中不包含表 的错误。 郁闷既然我用SQL语句绑定报,那报表中还要表干吗? 谁能解释下 C#大侠请进 关于aspx结尾如Entrance.aspx的连接的网站操作的问题。 加密和解密 谢谢各位,我想知道一般支持.net 2.0 的空间是否能用自定义的Handler??欢迎大家讨论 急急急急急急急急急急急急急急急急急急急急~~~~ DataGrid中如何动态获取高度值? 如何实现打印功能? 通过fileupload +button 怎么向远程服务器传图片? 关于财务金额精度问题服务端和客户端 有做过金额相关系统的咨询下 Html字符串提交给ashx 检测到不安全字符 请问如何以代码方式打开TreeView控件中指定的节点 有关界面的一个小问题
我就是要把它做gridview那样,通过SQL查询语句绑定数据。
当然你在cs中还得写代码.
poRpt.Load(Server.MapPath("CrystalReport1.rpt"));
SqlDataAdapter sda = new SqlDataAdapter();
string sql = "select * from DZLJ_03";
SqlConnection con = new SqlConnection(Custom.SqlConnectionString);
con.Open();
sda.SelectCommand = new SqlCommand(sql,con);
sda.SelectCommand.ExecuteNonQuery();
con.Close();
DataSet ds = new DataSet();
sda.Fill(ds, "RepairRecord");
poRpt.SetDataSource(ds);
this.CrystalReportViewer1.ReportSource = poRpt;
我是这样绑定的,我也不知道哪儿出了问题。请指教,谢谢!!
高手们,帮忙想象办法,谢谢!!!!!!!!
poRpt.SetDataSource(myData);
myData是你的数据集
DataAdapter 是离线模式数据库操作! 还是谢谢你的回答!!
ReportDocument poRpt = new ReportDocument();
poRpt.Load(Server.MapPath("CrystalReport1.rpt"));
string sql = "select * from DZLJ_03";
SqlConnection con = new SqlConnection(Custom.SqlConnectionString);
SqlCommand command = new SqlCommand(sql,con);
SqlDataAdapter sda = new SqlDataAdapter(command);
DataSet ds = new DataSet();
sda.Fill(ds);
poRpt.SetDataSource(ds);
this.CrystalReportViewer1.ReportSource = poRpt;
SqlDataAdapter sda = new SqlDataAdapter();
string sql = "select * from DZLJ_03";
SqlConnection con = new SqlConnection(Custom.SqlConnectionString);
con.Open();
sda.SelectCommand = new SqlCommand(sql, con);
sda.SelectCommand.ExecuteNonQuery();
con.Close();
DataSet ds = new DataSet();
sda.Fill(ds, "RepairRecord");
CrystalReportSource1.ReportDocument.Load(Server.MapPath("CrystalReport.rpt"));
//注意此处必需指明Dataset中的表的名称,否则会提示“您请求的报表需要更多信息.”
CrystalReportSource1.ReportDocument.SetDataSource(ds.Tables[0]);
CrystalReportSource1.DataBind();
CrystalReportViewer1.ReportSource = CrystalReportSource1;
CrystalReportViewer1.DataBind();
CrystalReportViewer1.BestFitPage = true;
CrystalReportViewer1.Width = Unit.Pixel(400);还是报 该报表中不包含表 的错误。 郁闷
既然我用SQL语句绑定报,那报表中还要表干吗? 谁能解释下