Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/asp.net/32.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Crystal报表查看器-ASP.net_Asp.net_Crystal Reports - Fatal编程技术网

Crystal报表查看器-ASP.net

Crystal报表查看器-ASP.net,asp.net,crystal-reports,Asp.net,Crystal Reports,我正在尝试将Crystal Report Viewer添加到asp.net web应用程序。我们正在使用为我们的桌面应用程序创建的报告,因此这些报告已经创建并运行。我们在两个平台上使用相同的查询连接到同一个数据库,数据库和查询在报表设计器中设置 以下是asp.net项目中Visual Studio Pro 2015中一个报告的预览: 我已将以下行添加到我的Reports.aspx页面: <CR:CrystalReportViewer ID="crptViewer" runat="serv

我正在尝试将Crystal Report Viewer添加到asp.net web应用程序。我们正在使用为我们的桌面应用程序创建的报告,因此这些报告已经创建并运行。我们在两个平台上使用相同的查询连接到同一个数据库,数据库和查询在报表设计器中设置

以下是asp.net项目中Visual Studio Pro 2015中一个报告的预览:

我已将以下行添加到我的Reports.aspx页面:

<CR:CrystalReportViewer ID="crptViewer" runat="server" AutoDataBind="true" />
装载时:

public partial class Reports : System.Web.UI.Page
{

    ReportDocument rptDocument;
    protected void Page_Load(object sender, EventArgs e)
    {
        string stack = "Page_Load()(Reports.aspx.cs)";
        try
        {
           rptDocument = new ReportDocument();
           rptDocument.Load(Server.MapPath("~\\Crystal\\UserListing.rpt"));
           crptViewer.ReportSource = rptDocument;

           //I have tried with and without the following:
           //crptViewer.DataBind();
           //and
           //crptViewer.RefreshReport();
        }
        catch (Exception EX)
        {
            IOClass.appendLog("Error in " + stack, EX.Message);
        }
    }
}
在这两种情况下加载页面时,我得到的是:

我正在load函数上记录异常,没有任何异常

知道我做错了什么吗?如果我能提供任何其他信息,请告诉我

感谢您抽出时间

在aspx上删除
然后像这样使用默认的html页面



这是在IIS服务器上运行还是在VS IIS上运行?可能这与Crystal的IIS配置和权限以及报告的登录信息最相关。我也有这样的问题,我需要在互联网上挖掘很多。首先,让我们试试这个,如果它不起作用,我会帮你配置IIS-谢谢你的评论。我已经修改了我的函数,以包含您引用的堆栈溢出中的连接信息,但它没有帮助。不过我确实从中得到了更多的信息。ApplyLogOnInfo部分中的TestConnectivity()函数返回true。我想这意味着与数据库的连接成功了?我还修改了.rpt文件的安全性,允许完全控制我的用户。为了回答您的问题,我正在Web Matrix 3上运行该应用程序,但我也尝试通过IIS(版本10.0.14393.0)运行该应用程序。您能否阅读另一篇文章,并告诉我您是否可以在您的环境中使用该应用程序?不幸的是,那篇文章没有任何帮助。
public partial class Reports : System.Web.UI.Page

{

ReportDocument rptDocument;
protected void Page_Load(object sender, EventArgs e)
    {
        string stack = "Page_Load()(Reports.aspx.cs)";
        try
        {
            if (Session["report"] != null)
            {
                crptViewer.ReportSource = Session["report"];

            }
        }
        catch (Exception EX)
        {
            IOClass.appendLog("Error in " + stack, EX.Message);
        }
    }

   //Button Click
   protected void generateReport(object sender, EventArgs e)
    {

        rptDocument = new ReportDocument();
        rptDocument.Load(Server.MapPath("~/Crystal/UserListing.rpt"));

        rptDocument.SetParameterValue("Company", 1);

        Session["report"] = rptDocument;


    }
}
public partial class Reports : System.Web.UI.Page
{

    ReportDocument rptDocument;
    protected void Page_Load(object sender, EventArgs e)
    {
        string stack = "Page_Load()(Reports.aspx.cs)";
        try
        {
           rptDocument = new ReportDocument();
           rptDocument.Load(Server.MapPath("~\\Crystal\\UserListing.rpt"));
           crptViewer.ReportSource = rptDocument;

           //I have tried with and without the following:
           //crptViewer.DataBind();
           //and
           //crptViewer.RefreshReport();
        }
        catch (Exception EX)
        {
            IOClass.appendLog("Error in " + stack, EX.Message);
        }
    }
}