Grid++Report 6 锐浪报表c#.net winfrom 简单DEMO 链接SQL server

官网下载地址:http://www.rubylong.cn/gridreport/download.htm

安装后设计报表在博客 Grid++ Report6.5使用

下面是链接数据库代码

界面:(所需DLL库)

代码:


    public partial class FrmGrid : Form
    {
        //定义Grid++Report报表主对象
        private GridppReport Report = new GridppReport();
        public FrmGrid()
        {
            InitializeComponent();
        }

        private void FrmGrid_Load(object sender, EventArgs e)
        {
           // MessageBox.Show(System.Windows.Forms.Application.StartupPath);
            //载入报表模板文件,必须保证 Grid++Report 的安装目录在‘C:\Grid++Report 6’下,
            //关于动态设置报表路径与数据绑定参数请参考其它例子程序
            Report.LoadFromFile(System.Windows.Forms.Application.StartupPath+"\\user.grf");
            Report.DetailGrid.Recordset.ConnectionString = @"数据库链接地址";
            //设置报表查询显示器控件的关联报表对象
            axGRDisplayViewer1.Report = Report;

            //启动报表运行
            axGRDisplayViewer1.Start();
        }

        //打印
        private void btnPrint_Click(object sender, EventArgs e)
        {
            Report.Print(true);
        }
        //打印浏览
        private void btnPrintPreview_Click(object sender, EventArgs e)
        {
            Report.PrintPreview(true);
        }
    }

效果图:

发布了134 篇原创文章 · 获赞 13 · 访问量 6万+

猜你喜欢

转载自blog.csdn.net/qq_36074218/article/details/104894173