C#初步体验FastReport 报表(图)


当前第2页 返回上一页


1

2

3

4

5

6

7

8

9

10

11

12

13

14

15

16

17

18

19

20

21

22

23

24

25

26

27

28

29

30

31

32

33

34

35

36

37

38

39

40

41

42

43

44

45

46

47

48

49

50

51

52

53

54

55

56

57

58

59

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.SqlClient;

 

namespace 测试FastReport

{

    public partial class Form1 : Form

    {

        private DataSet data;

 

        public Form1()

        {

            InitializeComponent();

        }

 

        private void button1_Click(object sender, EventArgs e)

        {

            string conStr = "Server='127.0.0.1';Initial catalog=WaiMaoJinKou;UID='sa';PWD='12345';Max Pool Size=512;";

            try

            {

                SqlConnection con = new SqlConnection(conStr);

                con.Open();

                SqlCommand sqlcmd = new SqlCommand();

                sqlcmd.Connection = con;

                sqlcmd.CommandText = @"SELECT * FROM [Event] ";

                SqlDataAdapter sda = new SqlDataAdapter(sqlcmd);

                data = new DataSet();

                sda.Fill(data);

                con.Close();

                sda.Dispose();

            }

            catch (Exception err)

            {

                MessageBox.Show(err.StackTrace);

            }

 

            try

            {

                FastReport.Report report = new FastReport.Report();

                //string filename = Application.StartupPath + @"\FrxReport\qualityEvent.frx";

                string filename = @"D:\qualityEvent.frx";

 

                report.Load(filename);

                report.RegisterData(data);

                report.GetDataSource(data.Tables[0].TableName).Enabled = true;

                report.Show();

            }

            catch (Exception err)

            {

                MessageBox.Show(err.Message);

            }

        }

    }

}

试了几次,只有使用.Net4.0的时候,FastReport才会被识别出来,所以开发的项目也需要重新设置一下,重新安装.Net4.0的框架包。

以上就是C#初步体验FastReport 报表(图)的详细内容!

返回前面的内容

相关阅读 >>

C#中default什么意思

.net的优点

c#中的arraylist是什么?

C#中的数据类型是什么?C#中的四种数据类型解释

详解C#实现获取汉字十六进制unicode编码字符串的示例代码

浅析C#中的“==”和equals的示例代码

C#怎么学

详细介绍用C#描述数据结构3:arraylist的图文代码

C#描述数据结构1:统计代码执行时间对象的代码详解

.net是否真的被国内市场嫌弃?

更多相关阅读请进入《C#》频道 >>




打赏

取消

感谢您的支持,我会继续努力的!

扫码支持
扫码打赏,您说多少就多少

打开支付宝扫一扫,即可进行扫码打赏哦

分享从这里开始,精彩与您同在

评论

管理员已关闭评论功能...