public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            ResultCrystalReport1 rpt = new ResultCrystalReport1();

            rpt.Site = this.Site;
            return(rpt);
        }
示例#2
0
        private void resultbutton_Click(object sender, EventArgs e)
        {
            SqlConnection connection = new SqlConnection();
            string        Link       = @"Data Source = DESKTOP-6LMCH95\SQLEXPRESS; DataBase = SMS;Integrated security = SSPI";

            connection.ConnectionString = Link;
            connection.Open();
            string query = "Select * From Result";
            // string query = "Select * From Result WHERE ID = '"+idtextBox.Text+"'";
            SqlCommand     cmda = new SqlCommand(query, connection);
            SqlDataAdapter sad  = new SqlDataAdapter();
            DataTable      dt   = new DataTable();

            sad.SelectCommand = cmda;
            sad.Fill(dt);

            ResultCrystalReport1 aRe = new ResultCrystalReport1();

            aRe.SetDataSource(dt);
            crystalReportViewer1.ReportSource = aRe;
        }