예제 #1
0
        public void Read()
        {
            SqlConnection conn = new SqlConnection(this.connectionString);
            SqlCommand comm = new SqlCommand("SELECT *FROM TbProductName ORDER BY ProductName", conn);

            SqlDataAdapter adap = new SqlDataAdapter();
            DataSets.StockDataSet dataset = new DataSets.StockDataSet();
            StockCrystalReport crp = new StockCrystalReport();

            try
            {
                conn.Open();
                adap.SelectCommand = comm;
                adap.Fill(dataset, "DataTable1");
                crp.SetDataSource(dataset);
                crystalReportViewer2.ReportSource = crp;
            }
            catch (Exception ex)
            {
                MessageBox.Show(ex.Message.ToString());
            }
            finally
            {
                conn.Close();
            }
        }
예제 #2
0
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     StockCrystalReport rpt = new StockCrystalReport();
     rpt.Site = this.Site;
     return rpt;
 }