이 기사는 당신을위한 것입니다.
Crystal Report with DataSet and DataTable using C#
우리의 데이터 소스에 우리의 보고서를 바인딩
using System;
using System.Collections.Generic;
using System.ComponentModel;
using System.Data;
using System.Drawing;
using System.Text;
using System.Windows.Forms;
using System.Data.OracleClient;
using System.IO;
namespace CrystalReportWithOracle
{
public partial class frmMain : Form
{
public frmMain()
{
InitializeComponent();
}
private void frmMain_Load(object sender, EventArgs e)
{
my_rpt objRpt;
// Creating object of our report.
objRpt = new my_rpt();
String ConnStr = "SERVER=mydb;USER ID=user1;PWD=user1";
OracleConnection myConnection = new OracleConnection(ConnStr);
String Query1 = "select a.PROJECT_ID,a.PROJECT_NAME,b.GROUP_NAME from
tbl_project a,tbl_project_group b where a.group_code= b.group_code";
OracleDataAdapter adapter = new OracleDataAdapter(Query1, ConnStr);
DataSet Ds = new DataSet();
// here my_dt is the name of the DataTable which we
// created in the designer view.
adapter.Fill(Ds, "my_dt");
if (Ds.Tables[0].Rows.Count == 0)
{
MessageBox.Show("No data Found", "CrystalReportWithOracle");
return;
}
// Setting data source of our report object
objRpt.SetDataSource(Ds);
CrystalDecisions.CrystalReports.Engine.TextObject root;
root = (CrystalDecisions.CrystalReports.Engine.TextObject)
objRpt.ReportDefinition.ReportObjects["txt_header"];
root.Text = "Sample Report By Using Data Table!!";
// Binding the crystalReportViewer with our report object.
crystalReportViewer1.ReportSource = objRpt;
}
}
}
편집 : 또한이 보일 것이다;
ADO.NET Datatable as Crystal Report datasource
How do I populate Crystal Reports, using a DataTable?
살아라 내 보고서 템플릿이며이 파일로 프로젝트에 추가되고 있으며, 나는 그것을로드해야하고 내가 어떤 결정 보고서가 실제로 뷰어가없는 것입니다. 어떻게해야합니까? –
@Faulty 나는 너가이 기사를 절대적으로 읽었다 고 생각한다 http://www.c-sharpcorner.com/uploadfile/mahesh/crystalreportsintroduction11082005014959am/crystalreportsintroduction.aspx –