本帖最后由 soarandy 于 2009-09-18 18:34:56 编辑

解决方案 »

  1.   

    cr.Load(Application.StartupPath + "CrystalReport2.rpt"); 
    cr.SetDataSource(ds);//此位置报错 
    不用這兩句試一下,另外多種查詢的話是要做多報表的,用代碼很多功能實現不了!
      

  2.   

    是下面这句话的问题:
      cr.Load(Application.StartupPath + "CrystalReport2.rpt"); 
    Load里面放的是CrystalReport2.rpt的路径;所以若是在编写软件时,要写成下面这种形式:
                       string strPath = Application.StartupPath.Substring(0, Application.StartupPath.Substring(0, Application.StartupPath.LastIndexOf("\\")).LastIndexOf("\\"));
                       strPath += @"\CrystalReport1.rpt";
                       cr.Load(strPath);