在Visual Studio 2010中使用Crystal Reports生成报告 [英] Generate a report using Crystal Reports in Visual Studio 2010
本文介绍了在Visual Studio 2010中使用Crystal Reports生成报告的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
如何在Visual Studio 2010中使用Crystal Reports生成报告?
How to Generate a report using Crystal Reports in Visual Studio 2010?
推荐答案
它可能对您有用....
试试吧
在Visual Studio 2010中使用Crystal Reports生成报告
it may be useful for you.......
Let''s try it
Generate a report using Crystal Reports in Visual Studio 2010
首先,您创建一个Aspx.File,并获取放置在ToolBox中的CrystalReport Viewer控件.
< html xmlns ="http://www.w3.org/1999/xhtml">
< head runat ="server">
< title>无标题页面</title>
< link href ="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"
rel ="stylesheet" type ="text/css"/>
< link href ="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"
rel ="stylesheet" type ="text/css"/>
< link href ="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"
rel ="stylesheet" type ="text/css"/>
</head>
< body>
< form id ="form1" runat ="server">
< div>
< CR:CrystalReportViewer ID ="CrystalReportViewer1" runat ="server" AutoDataBind ="true"
样式="position:相对"/>
& nbsp;
</div>
</form>
</body>
</html>
在Aspx.CS FILE
中
使用系统;
使用System.Data;
使用System.Configuration;
使用System.Collections;
使用System.Web;
使用System.Web.Security;
使用System.Web.UI;
使用System.Web.UI.WebControls;
使用System.Web.UI.WebControls.WebParts;
使用System.Web.UI.HtmlControls;
使用CrystalDecisions.CrystalReports;
使用CrystalDecisions.CrystalReports.Engine;
使用System.Data.SqlClient;
受保护的void Page_Load(对象发送者,EventArgs e)
{
ReportDocument doc = new ReportDocument();
JPCIReports.classwiseDataTable cldt =新的JPCIReports.classwiseDataTable();
SqlDataAdapter ad =新的SqlDataAdapter(SELECT * from Tablename,con");
ad.Fill(cldt);
doc.SetDataSource((DataTable)cldt);
CrystalReportViewer1.ReportSource = doc;
CrystalReportViewer1.DataBind();
}
}
First u create One Aspx.File and Take CrystalReport Viewer Control which is placed in ToolBox.
<html xmlns="http://www.w3.org/1999/xhtml" >
<head runat="server">
<title>Untitled Page</title>
<link href="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"
rel="stylesheet" type="text/css" />
<link href="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"
rel="stylesheet" type="text/css" />
<link href="/aspnet_client/System_Web/2_0_50727/CrystalReportWebFormViewer3/css/default.css"
rel="stylesheet" type="text/css" />
</head>
<body>
<form id="form1" runat="server">
<div>
<CR:CrystalReportViewer ID="CrystalReportViewer1" runat="server" AutoDataBind="true"
Style="position: relative" />
</div>
</form>
</body>
</html>
in Aspx.CS FILE
using System;
using System.Data;
using System.Configuration;
using System.Collections;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.UI.HtmlControls;
using CrystalDecisions.CrystalReports;
using CrystalDecisions.CrystalReports.Engine;
using System.Data.SqlClient;
protected void Page_Load(object sender, EventArgs e)
{
ReportDocument doc = new ReportDocument();
JPCIReports.classwiseDataTable cldt = new JPCIReports.classwiseDataTable();
SqlDataAdapter ad = new SqlDataAdapter(SELECT * from Tablename",con");
ad.Fill(cldt);
doc.SetDataSource((DataTable)cldt);
CrystalReportViewer1.ReportSource = doc;
CrystalReportViewer1.DataBind();
}
}
这篇关于在Visual Studio 2010中使用Crystal Reports生成报告的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文