rdlc,reportview,报表实例

 

string sql = "select top 5 Event_Time,Event_ReMark,Event_UseMoney,Event_Money,Event_SZ,Kind_Id,User_Id,Event_Id from tbEvent order by Event_Time desc";
            //DataSet ds = hystorfobll.ExecuteQueryDataSet(sql);

            OleDbDataAdapter myAdapter;
            DataSet ds = new DataSet();
            OleDbCommand cmd = new OleDbCommand(sql, DbHelp.con);
            ds.Clear();
            myAdapter = new OleDbDataAdapter(cmd);

            DbHelp.con.Open();
            myAdapter.Fill(ds, "tbEvent");

            this.reportViewer1.LocalReport.ReportEmbeddedResource = "SmallPurse.rpt.Report1.rdlc";
            this.reportViewer1.LocalReport.DataSources.Clear();
            this.reportViewer1.LocalReport.DataSources.Add(new Microsoft.Reporting.WinForms.ReportDataSource("smallPurseDataSet_tbEvent", ds.Tables[0]));
            // TODO: 这行代码将数据加载到表“DataSet1.HY_Storage”中。您可以根据需要移动或移除它。
            //this.HY_StorageTableAdapter.Fill(this.DataSet1.HY_Storage);
            //设置打印布局模式,显示物理页面大小
            this.reportViewer1.SetDisplayMode(Microsoft.Reporting.WinForms.DisplayMode.PrintLayout);
            //缩放模式为百分比,以100%方式显示
            this.reportViewer1.ZoomMode = Microsoft.Reporting.WinForms.ZoomMode.Percent;
            this.reportViewer1.ZoomPercent = 100;

            this.reportViewer1.RefreshReport();

 

 

smallPurseDataSet_tbEvent表示 xsd:smallPurseDataSet 的表结构tbEvent

你可能感兴趣的:(sql,String,cmd,user,报表,dataset)