c# FastReport开发报表
来源:互联网 发布:matlab 一维数组画图 编辑:程序博客网 时间:2024/04/29 16:32
原文 http://blog.csdn.net/hws1058648831a/article/details/12579977
本文介绍c#应用FastReport开发报表,因此首先附该工具下载地址: http://download.csdn.net/detail/hws1058648831a/6378499
下载解压后可以直接使用,里面还有相关实例供参考。
下面看看一个简单的例子:
1 打开visual studio 2010创建一个工程名称为WfmFastReport,编辑界面,然后添加FastReport.dll ,FastReport.Bars.dll,FastReport.Editor.dll 的引用。
FastReport.dll ,FastReport.Bars.dll,FastReport.Editor.dll在下载包里有的。
代码非常简单,如下:
using System; using System.Collections.Generic; using System.ComponentModel; using System.Data; using System.Drawing; using System.Linq; using System.Text; using System.Windows.Forms; using System.Data.SqlClient;using FastReport; using FastReport.Editor;namespace WfmFastReport { public partial class Form1 : Form { public Form1() { InitializeComponent(); } private DataSet data; private void button1_Click(object sender, EventArgs e) { string conStr = @"server=***;user id=**;password=***;initial catalog=****"; try { SqlConnection con = new SqlConnection(conStr); con.Open(); SqlCommand sqlcmd = new SqlCommand(); sqlcmd.Connection = con; sqlcmd.CommandText = "select top 100 * from item"; SqlDataAdapter sda = new SqlDataAdapter(sqlcmd); data = new DataSet(); sda.Fill(data); con.Close(); sda.Dispose(); MessageBox.Show("加载数据成功!"); } catch (Exception err) { MessageBox.Show(err.Message); } } private void button2_Click(object sender, EventArgs e) { try { FastReport.Report report = new FastReport.Report(); string filename = @"C:\Documents and Settings\Administrator\桌面\检查项目.frx"; report.Load(filename); report.RegisterData(data); report.GetDataSource(data.Tables[0].TableName).Enabled = true; report.Show(); } catch (Exception err) { MessageBox.Show(err.Message); } } } }
检查项目.frx文件就是FastReport设计出的报表模板,非常简单,有兴趣的朋友可以试一试。
下面看看效果:
0 0
- c# FastReport开发报表
- c# FastReport开发报表
- FastReport C#端控制报表样式
- 使用FastReport Studio开发报表(一)
- 使用FastReport Studio开发报表(二)
- 使用FastReport Studio开发报表(三)
- 使用FastReport Studio开发报表(四)
- 使用FastReport Studio开发报表(一)
- VS2015开发FastReport报表系列--0001
- 报表fastreport
- FastReport.Net C#程序邦定报表模版
- FastReport.Net C#程序邦定报表模版
- FastReport.Net_ C#程序邦定报表模版
- C#使用FastReport 报表初步体验(图文)
- web报表打印控件(Delphi + fastreport 开发的Activex)
- FastReport使用WebReport开发Web报表的步骤
- C# FastReport
- FastReport报表制作方法
- 黑马程序员_日记9_Java学习感言
- 网站漏洞扫描工具
- emacs中格式化代码
- VMware安装失败 “Failed to create the requested registry key Key:installer Error:1021"
- CentOS 6.2编译gcc失败,kernel-headers错误
- c# FastReport开发报表
- 蓝桥杯 ALGO-79 删除数组零元素(水题、数组)
- 求从根节点到叶子节点的所有路径组成的数的和
- 利用virtualenv管理Python环境
- Treasure Exploration
- CentOS 6.2编译gcc失败,kernel-headers错误
- localStorage的使用方法
- 黑马程序员_日记10_Java包
- 第一篇-前言