to jpyc:
水晶报表专栏中没有提供具体的解决办法啊
请多帮忙啊

解决方案 »

  1.   

    string  strSQL  =  "select  *  from  Customers  where  CustomerID  like  '"  +  this.aa.Text  +  "%'"; 
    DataSet  ds  =  db.ExecSqlForDataSet(strSQL); 
    this.Label1.Text  =  db.GetLastErrorMsg(); 
    if  (ds  ==  null)  return; 
    ReportDocument cr  =  new  ReportDocument(); //CrystalDecisions.CrystalReports.Engine 命名空间
    cr.load(报表绝对路径)
    cr.SetDataSource(ds);
      

  2.   

    大家一起去这个贴子支持一下!!!
    http://expert.csdn.net/Expert/TopicView1.asp?id=2291055
    CSDN 开个 Crystal Report 版吧!!!&&&我与水晶报表……
    haibodotnet 海波.NET想了解更多水晶报表的知识和技巧,请到
    NET专栏 -> 水晶报表专栏
    http://218.56.11.178:8009/
    jpyc(九品御厨-进军嵌入式)
      

  3.   

    请问海波:
    我用你的方法还是登陆失败啊
    到底是什么原因啊
    报表文件中能不能动态绑定我从DataSet筛选出来的值啊!
    很急!请您帮忙啊!!!!!
      

  4.   

    PUSH 模式使用 DataSet 作为数据源,而不是数据库,所以报表方面不用登录数据库……是不是你生成 DataSet 方面的登录错误……
      

  5.   

    谢谢海波!
    在请教:
    如果我取会的DataSet在报表中显示,如何在报表中设计啊
    是不是就设计报表的框架,数据就动态显示。要这样做,代码如何写啊???
    我用上面的方法在报表中就是不显示数据啊
    万分感谢!
      

  6.   

    数据集我可以保证没有问题,因为我的记录集绑定到DataGrid控件,显示出来的结果是正确的。
      我设计的水晶报表所要阅览打印的数据来自于中间层提供的数据集,中间层提供的记录集如果我直接绑定到DataGrid等Web控件,显示的结果和预期的是一样的。水晶报表是不是没有直接显示记录集(和数据库无关)的能力?!应该是不可能的???!!!
    请海波帮忙!!!!!!!
      

  7.   

    只要水晶报表设计时,所用的表的个数及结构与 DataSet 里相同就可以!
      

  8.   

    再请教海波:
    能讲详细点吗?我所用的ds是中间层提供的,而中间层提供的ds是经过一些数据处理后得到的
    如果按 准push模式可以取得数据集中的数据,但我的情况跟它不同啊
    很急啊!!!!!!!!
    谢谢
      

  9.   

    在 VS.NET 里新建水晶报表,在“数据库连结向导”里选择“项目数据”,使用 DataSet 作为数据源……
      

  10.   

    this.CrystalReportViewer1.ReportSource=@"D:\Program Files\Microsoft Visual Studio .NET 2003\Crystal Reports\Samples\Reports\General Business\World Sales Report.rpt";

    oRpt = new ReportDocument();
    oRpt.Load("C:\\Inetpub\\wwwroot\\AppKJXM\\Report\\CrystalReportTest.rpt");
    TableLogOnInfo logOnInfo = new TableLogOnInfo ();
    int i = 0; // 对报表中的每个表依次循环。
    try
    {
    for (i=0;i == oRpt.Database.Tables.Count - 1;i++)
    {
    // 设置当前表的连接信息。
    logOnInfo.ConnectionInfo.ServerName = "dwfbenben";
    logOnInfo.ConnectionInfo.DatabaseName = "kjcgnew";
    logOnInfo.ConnectionInfo.UserID = "kjcg";
    logOnInfo.ConnectionInfo.Password ="kjcg";
    oRpt.Database.Tables[i].ApplyLogOnInfo(logOnInfo);
    //oRpt.Database.Tables[i].ApplyLogOnInfo (logOnInfo);
    }
    this.CrystalReportViewer1.ReportSource=oRpt;

    //this.CrystalReportViewer1.DataBind();
    }
    catch(Exception ee)
    {
    string strErr=ee.Message;
    }