private void pageChanged() { try { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.WaitCursor; // BLL.IRep单品汇总表 bll = new BLL.Rep单品汇总表(); var dt = bll.GetData(key, pageSize, pageIndex, out total, "编号", "单数,数量,金额"); // dt_excel = dt; this.dg_data.DataSource = dt; int n = pageIndex; int m = (int)Math.Ceiling((decimal)this.total / (decimal)this.pageSize); this.pageCount = m; this.Label1.Text = string.Format("第{0}页,共{1}页", n.ToString(), m.ToString()); } catch (Exception e) { Program.frmMsg(e.Message); } finally { System.Windows.Forms.Cursor.Current = System.Windows.Forms.Cursors.Default; } }
private void btn_export_Click(object sender, EventArgs e) { var f = new SaveFileDialog(); f.Filter = "*.xls|*.xls"; if (dt_excel == null) { MessageBox.Show("请先查询再导出!"); } else if (f.ShowDialog() == System.Windows.Forms.DialogResult.OK) { BLL.IRep单品汇总表 bll = new BLL.Rep单品汇总表(); dt_excel = bll.GetData(key, 10000, 1, out total, "编号", "单数,数量,金额"); ToExcel.toExcel(dt_excel, f.FileName); } }