public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { PrintBookUpDown rpt = new PrintBookUpDown(); rpt.Site = this.Site; return(rpt); }
private void FrmLookUpDown_Load(object sender, EventArgs e)//初始化 { if (flag == 1 && ware == "图书") { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "WareUp"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@Flag", 1); data.Clear(); adapter.Fill(data.book_info); PrintBookUpDown bookup = new PrintBookUpDown(); bookup.SetDataSource(data); this.crystalReportViewer1.ReportSource = bookup; } else if (flag == 2 && ware == "光盘") { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "WareUp"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@Flag", 2); data.Clear(); adapter.Fill(data.cd_info); PrintCdUpDown cdup = new PrintCdUpDown(); cdup.SetDataSource(data); this.crystalReportViewer1.ReportSource = cdup; } else if (flag == 3 && ware == "图书") { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "WareDown"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@Flag", 1); data.Clear(); adapter.Fill(data.book_info); PrintBookUpDown bookdown = new PrintBookUpDown(); bookdown.SetDataSource(data); this.crystalReportViewer1.ReportSource = bookdown; } else if (flag == 4 && ware == "光盘") { SqlConnection connect = InitConnect.GetConnection(); MyDataSet data = new MyDataSet(); SqlDataAdapter adapter = new SqlDataAdapter(); SqlCommand select = new SqlCommand(); adapter.SelectCommand = select; adapter.SelectCommand.Connection = connect; adapter.SelectCommand.CommandText = "WareDown"; adapter.SelectCommand.CommandType = CommandType.StoredProcedure; adapter.SelectCommand.Parameters.AddWithValue("@Flag", 2); data.Clear(); adapter.Fill(data.cd_info); PrintCdUpDown cddown = new PrintCdUpDown(); cddown.SetDataSource(data); this.crystalReportViewer1.ReportSource = cddown; } }