Exemple #1
0
        public void Read(string srr)
        {
            SqlConnection conn = new SqlConnection(this.connectionString);
            SqlCommand comm = new SqlCommand("SELECT *FROM tblAppoinmentLetter WHERE Name = @Name ORDER BY Name", conn);

            comm.Parameters.Add("@Name", SqlDbType.VarChar, 50);
            comm.Parameters["@Name"].Value = comboBox1.Text;

            SqlDataAdapter adap = new SqlDataAdapter();
            DataSets.AppoinmentDataSet dataset = new DataSets.AppoinmentDataSet();
               AppoinmentLetterCrystalReport crp = new AppoinmentLetterCrystalReport();

            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();
            }
        }
 public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
 {
     AppoinmentLetterCrystalReport rpt = new AppoinmentLetterCrystalReport();
     rpt.Site = this.Site;
     return rpt;
 }