public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { CrystalReportSaleByItemAll rpt = new CrystalReportSaleByItemAll(); rpt.Site = this.Site; return(rpt); }
private void button1_MouseClick(object sender, MouseEventArgs e) { try { CrystalReportSaleByItemAll ob = new CrystalReportSaleByItemAll(); ByPass2(ob); ob.SetParameterValue("startd", dateTimePicker1.Value); ob.SetParameterValue("endd", dateTimePicker2.Value); crystalReportViewer1.ReportSource = ob; crystalReportViewer1.Refresh(); crystalReportViewer1.Show(); } catch (Exception exp) { MessageBox.Show(exp.Message, "Exception Error"); } }
private static void ByPass2(CrystalReportSaleByItemAll ob) { TableLogOnInfos crtableLogoninfos = new TableLogOnInfos(); TableLogOnInfo crtableLogoninfo = new TableLogOnInfo(); ConnectionInfo crConnectionInfo = new ConnectionInfo(); Tables CrTables; crConnectionInfo.ServerName = "."; crConnectionInfo.DatabaseName = "RMSDB"; crConnectionInfo.UserID = "sa"; crConnectionInfo.Password = Variable.Class1.a; CrTables = ob.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table CrTable in CrTables) { crtableLogoninfo = CrTable.LogOnInfo; crtableLogoninfo.ConnectionInfo = crConnectionInfo; CrTable.ApplyLogOnInfo(crtableLogoninfo); } }