与C#中的CrystalReport相关 [英] Related to CrystalReport in C#

查看:72
本文介绍了与C#中的CrystalReport相关的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Hi Friends ,,,

我在asp.net网站上创建了CrystalReport.但是在CrystalReport中却没有显示数据.它仅显示Colum名称. 我的编码在这里.

我拥有表Table1(id,name,place,Mobileno.)

我在CrystalReport中创建用于绑定数据的Dataset1.

在Default.aspx.cs中

 使用 CrystalDecisions.CrystalReports.Engine;
使用 CrystalDecisions.Shared;
使用 System.Data.SqlClient;

ReportDocument report =  ReportDocument();

 SqlConnection con =  SqlConnection( @"  );
        字符串 q = " ;
        SqlCommand cmd =  SqlCommand(q,con);
        SqlDataAdapter adp =  SqlDataAdapter(cmd);
        DataSet1用户=  DataSet1();
        adp.Fill(user," );

        report.FileName = Server.MapPath(" );
        report.SetDataSource(user);
        CrystalReportViewer1.ReportSource =报告; 



[edit]代码块扩展到整个代码段-OriginalGriff [/edit]

解决方案

我认为您只分配了要报告的数据集,而没有使用这些值数据集上的报表.

不了解数据库结构和报告格​​式就很难解释a

但请看下面的文章,它将对您有所帮助.

使用带有数据集的C#创建Crystal报表 [ ^ ]

Hi Friends,,,

I am create CrystalReport in asp.net Website.But in CrystalReport Data are not Display.It Display only Colum name..
My coding is here.

I hava table Table1(id,name,place,Mobileno.)

I create Dataset1 for bind data in CrystalReport.

And in Default.aspx.cs

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

ReportDocument report = new ReportDocument();

 SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\Suresh\My Documents\Visual Studio 2008\WebSites\WebSite1\App_Data\Database.mdf;Integrated Security=True;Connect Timeout=30;User Instance=True");
        string q = "select * from Table1";
        SqlCommand cmd = new SqlCommand(q, con);
        SqlDataAdapter adp = new SqlDataAdapter(cmd);
        DataSet1 user = new DataSet1();
        adp.Fill(user, "users");

        report.FileName = Server.MapPath("CrystalReport.rpt");
        report.SetDataSource(user);
        CrystalReportViewer1.ReportSource = report;



[edit]Code block extended to cove entire code fragment - OriginalGriff[/edit]

解决方案

I think you have only assigned the data set to report and not used the values of dataset on to report.

Its hard to explain without knowing your database stucture and report formata

but have a look into below article it will help you.

Creating Crystal Reports using C# with Datasets[^]


这篇关于与C#中的CrystalReport相关的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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