Ver Mensaje Individual
  #10 (permalink)  
Antiguo 22/11/2004, 16:40
Zyanya_80
 
Fecha de Ingreso: septiembre-2004
Mensajes: 217
Antigüedad: 19 años, 7 meses
Puntos: 0
Espero que esto te pueda servir



private void Page_Load(object sender, System.EventArgs e)
{
//Crystal Report Variables
formatos.PagosPendientes crReportDocument = new formatos.PagosPendientes();
TableLogOnInfo crTableLogOnInfo = new TableLogOnInfo();
ConnectionInfo crConnectionInfo = new ConnectionInfo();
//Crystal Report Properties
CrystalDecisions.CrystalReports.Engine.Database crDatabase;
CrystalDecisions.CrystalReports.Engine.Tables crTables;
//String de conexion
crConnectionInfo.ServerName = "93341\\RENE";
crConnectionInfo.DatabaseName = "productos";
crConnectionInfo.UserID = "catalogo";
crConnectionInfo.Password = "catalogo";
crDatabase = crReportDocument.Database;
crTables = crDatabase.Tables;
foreach(CrystalDecisions.CrystalReports.Engine.Tab le crTable in crTables)
{
crTableLogOnInfo = crTable.LogOnInfo;
crTableLogOnInfo.ConnectionInfo = crConnectionInfo;
crTable.ApplyLogOnInfo(crTableLogOnInfo);
}
this.CrystalReportViewer1.ReportSource = crReportDocument;
Condiciones_del_visualizador();
}


private void Condiciones_del_visualizador()
{
this.CrystalReportViewer1.BestFitPage = false;
this.CrystalReportViewer1.BorderColor = Color.FromArgb(0x78006599);
this.CrystalReportViewer1.BorderStyle = BorderStyle.Solid;
this.CrystalReportViewer1.BorderWidth = 1;

this.CrystalReportViewer1.DisplayGroupTree = false;
this.CrystalReportViewer1.DisplayToolbar = false;
this.CrystalReportViewer1.DisplayPage = true;

this.CrystalReportViewer1.HasDrillUpButton = false;
this.CrystalReportViewer1.HasGotoPageButton = false;
this.CrystalReportViewer1.HasPageNavigationButtons = true;
this.CrystalReportViewer1.HasRefreshButton = false;
this.CrystalReportViewer1.HasSearchButton = false;
this.CrystalReportViewer1.HasZoomFactorList = true;

this.CrystalReportViewer1.SeparatePages = true;
this.CrystalReportViewer1.ShowFirstPage();
this.CrystalReportViewer1.PageZoomFactor = 100;
this.CrystalReportViewer1.Height = 360;
this.CrystalReportViewer1.Width = 760;
}
}


sin embargo creo que asi es mejor ...


private void Page_Load(object sender, System.EventArgs e)
{
string sql="SELECT * from entidad where cve_entidad not in ('00', '01', '02', '03', '05', '30', '32')";
//string sql="SELECT e.cve_entidad, e.desc_entidad from entidad e, municipio m Where e.cve_entidad = m.cve_entidad";
SqlConnection conn = new SqlConnection(ConfigurationSettings.AppSettings["ConnectionString"]);
SqlDataAdapter da = new SqlDataAdapter(sql,conn);
DataSet ds = new DataSet();
da.Fill(ds,"entidad");
reporte = new formatos.entidad();
reporte.Database.Tables["entidad"].SetDataSource(ds.Tables["entidad"]);
this.CrystalReportViewer1.ReportSource = reporte;
da.Dispose();
ds.Dispose();
conn.Dispose();
this.CrystalReportViewer1.ReportSource = reporte;
}


nota
formatos.PagosPendientes crReportDocument
se crea una instancia del reporte como una clase

espero que pueda servir de algo por cierto si sabes como exportar a excel
comparte el codigo ...