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);
        }
    }

效果圖:

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章