public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { SOReport rpt = new SOReport(); rpt.Site = this.Site; return(rpt); }
private void btnPrint_Click(object sender, EventArgs e) { SqlConnection con; ConnectionString cs = new ConnectionString(); SqlCommand cmd; SOReport rpt = new SOReport(); SqlDataAdapter myDA = new SqlDataAdapter(); softwenDS myDS = new softwenDS(); //The report you created. cmd = new SqlCommand(); //The DataSet you created. con = new SqlConnection(cs.DBConn); cmd.Connection = con; cmd.CommandText = "SELECT * from DbNewSales where Orderno='" + txtOrderNo.Text + "'"; cmd.CommandType = CommandType.Text; myDA.SelectCommand = cmd; myDA.Fill(myDS, "DbNewSales"); // myDA.Fill(myDS, "ProductCode"); rpt.SetDataSource(myDS); crystalReportViewer1.ReportSource = rpt; //sr.Show(); }