public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport() { DSHoSoKheUoc rpt = new DSHoSoKheUoc(); rpt.Site = this.Site; return(rpt); }
private void frmDSKheUoc_Load(object sender, EventArgs e) { DSHoSoKheUoc rpt = new DSHoSoKheUoc(); CrystalDecisions.CrystalReports.Engine.Table tblCurrent; CrystalDecisions.Shared.TableLogOnInfo tliCurrent = new CrystalDecisions.Shared.TableLogOnInfo(); DataService InfoSQL = new DataService(); try { for (int i = 0; i < rpt.Database.Tables.Count; i++) { tblCurrent = rpt.Database.Tables[i]; tliCurrent.ConnectionInfo.ServerName = InfoSQL.servername; tliCurrent.ConnectionInfo.UserID = InfoSQL.username; tliCurrent.ConnectionInfo.Password = InfoSQL.password; tliCurrent.ConnectionInfo.DatabaseName = InfoSQL.database; //if(InfoSQL.security.Equals("True")) tliCurrent.ConnectionInfo.IntegratedSecurity = Convert.ToBoolean(InfoSQL.security); tblCurrent.ApplyLogOnInfo(tliCurrent); } } catch { } crystalReportViewer1.ReportSource = rpt; }