string connstring = ConfigurationManager.ConnectionStrings["SqlConnectionString"].ToString() + ";Provider=SQLNCLI.1";
            FastReport.TfrxReportClass report = new FastReport.TfrxReportClass();
            report.LoadReportFromFile(AppDomain.CurrentDomain.BaseDirectory + "Report\\" + value);
            report.SetVariable("Connstring", "'" + connstring + "'");
            report.SetVariable("ID", id);
            report.SetVariable("ufd1", "'" + SqlHelper.GetLinkName(CurrentUser.UserID, company) + "UFD1'");
            report.SetVariable("cufd", "'" + SqlHelper.GetLinkName(CurrentUser.UserID, company) + "CUFD'");
            report.PrepareReport(true);
            report.PrintOptions.ShowDialog = false;
            report.ShowReport();
            report.PrintReport();在vs中调试时可以打印预览出来,发布出去后就没反应了,也预览不了。
注:发布在自己电脑上测试的,有安装fastreport。

解决方案 »

  1.   

    本帖最后由 net_lover 于 2011-08-24 14:36:46 编辑
      

  2.   

    report.LoadReportFromFile(AppDomain.CurrentDomain.BaseDirectory + "Report\\" + value);可以查看AppDomain.CurrentDomain.BaseDirectory + "Report\\" + value这个路径么。 此路径存在不 还有访问权限
      

  3.   

    同样的代码在一台电脑上,一个是vs生成的一个是系统的IIS,为什么调试的时候是可以。
      

  4.   

    路径不正确会抛出异常的。
    把VS附加到IIS的进程调试没有任何异常,只是走完了没有反应。
      

  5.   

    vs的运行账户是当前登录用户,
    iis里面是匿名账户,
    权限差的远了
      

  6.   

    這個目前只能用瀏覽器的打印功能,需要自己修很多代碼的,如果你不懂就別使用這個了下面這個就可以
    http://www.stimulsoft.com/ReportsWeb.aspx