如何在visual studio 2012中为asp .net生成水晶报告 [英] how to generate crystal report in visual studio 2012 for asp .net

查看:82
本文介绍了如何在visual studio 2012中为asp .net生成水晶报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨..我想在Visual Studio 2012中的asp .net中生成水晶报告。但它没有给出任何错误而是浏览器显示空白页面(没有水晶报告页面)。



我生成水晶报告所遵循的步骤如下:

1.采用数据集。然后添加了一个DataTable。从我的sql数据库表中添加了三列,即id,pname,price。

2.使用CrystalReport.rpt和Selected Use Report Wizard。添加了数据集。



Hi.. I want to generate crystal report in asp .net in Visual studio 2012. But it doesn't giving any error instead browser showing an empty page(No crystal report page).

Steps I have followed to generate a crystal report is as of follows:
1. Took a DataSet. Then added a DataTable. Added three columns as of my sql database table i.e. id,pname,price.
2. Took a CrystalReport.rpt and Selected Use Report Wizard. Added dataset.

using CrystalDecisions.CrystalReports.Engine;
using CrystalDecisions.Shared;
using System.Data;
using System.Data.SqlClient;

public partial class _Default : System.Web.UI.Page
{
    private SqlConnection cn = new SqlConnection("user id=sa;password=chiklu;database=SRS;server=CHIKLU-PC");
    protected void Page_Load(object sender, EventArgs e)
    {
        cn.Open();
        SqlCommand cmd = new SqlCommand("SELECT abcd.id,abcd.pname,qwer.price FROM abcd JOIN qwer ON abcd.id=qwer.id",cn);
        SqlDataAdapter da = new SqlDataAdapter(cmd);
        DataSet ds = new DataSet();
        da.Fill(ds);
        ReportDocument rpd = new ReportDocument();
        rpd.Load(Server.MapPath("CrystalReport.rpt"));
        rpd.SetDatabaseLogon("sa","chiklu","CHIKLU-PC","SRS");
        rpd.SetDataSource(ds);
        CrystalReportViewer1.ReportSource = rpd;
        cn.Close();
    }
} 

推荐答案

试试这个:



看看这里帮帮我....

1)在任何有/或水晶报告运行时引擎安装的机器上,转到C\inetpub\wwwroot文件夹。 br />
2)复制wwwroot目录中的aspnet_client文件夹。



3)将此文件夹粘贴到网站目录文件夹中。我假设这适用于从虚拟目录创建的Web应用程序,只需将其粘贴到虚拟目录中。





Crystal-Reports-not-rendering


您好Chiklu,



您使用的是哪个版本的Crystal Report?

我相信如果你添加参考Crystal Reports 13.0.2000.0版本,它应该可以正常工作。



的确,我正在使用它。



问候,

Abhi
Hi Chiklu,

Which version of Crystal Report are you using?
I believe if you add reference of Crystal Reports 13.0.2000.0 version, it should work fine.

Indeed, I'm using it so.

Regards,
Abhi


这篇关于如何在visual studio 2012中为asp .net生成水晶报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆