日期:2014-05-20  浏览次数:20745 次

水晶报表提示登录DataSet的问题
参考阿泰把图片加入报表的方法,做了个功能,显示一个客户信息表,但是总是有这样的提示:

您请求的报表需要更多信息.



--------------------------------------------
  DataSet1  
服务器名:  
数据库名:  
用户名:  
密码:  
 使用集成安全性  

代码是这样的,代码上应该没错吧
C# code
protected void Page_Load(object sender, EventArgs e)
    {         
        
        string cmdtxt = "select * from customers where name='" + Session["newname"].ToString() + "'and ID ='" + Session["newidno"].ToString() + "'";
        DataSet reportDs = Data.GetDs(cmdtxt);

        string path = 。。。;
        FileStream fs = new FileStream(path,FileMode.Open,FileAccess.Read);
        BinaryReader br = new BinaryReader(fs);
        byte[] bt = br.ReadBytes((int)fs.Length);
        fs.Close();

        reportDs.Tables.Add("picture");
        reportDs.Tables["picture"].Columns.Add("pic", System.Type.GetType("System.Byte[]"));
        DataRow row = reportDs.Tables["picture"].NewRow();
        row[0] = bt;
        reportDs.Tables["picture"].Rows.Add(row);

        report.Load(Server.MapPath("~/CrystalReport.rpt"));
        report.SetDataSource(reportDs);
        CrystalReportViewer1.ReportSource = report;}

   


------解决方案--------------------
reportDs里最终有两个表,customers 和 picture
那你实际的模板中,是怎么用这两个表的,表名和字段都对应吗
------解决方案--------------------
让数据集的表名:customers
DataSet reportDs = Data.GetDs(cmdtxt,"customers");
然后再让表的字段名跟数据集的字段名一致。试试.......