Ejemplo n.º 1
0
 private void Fprint_Load(object sender, EventArgs e)
 {
     fMenu xf = new fMenu();
     this.Left = xf.Left + 167;
     this.Top = xf.Top + 75;
     this.Width = Screen.PrimaryScreen.Bounds.Width - xf.panel1.Width - 160;
     this.Height = Screen.PrimaryScreen.Bounds.Height - xf.Top - 170;
     reportDocument1.FileName = Program.lAppPath + "\\pr.rpt";
     tbl = reportDocument1.Database.Tables["Tmp"];
     list = reportDocument1;
     sql = " select * from Tmp ";
     tb = Program.ExecSelect(sql);
     if (tb.Rows.Count == 0)
     {
         MessageBox.Show("没有符合该条件的记录!", "提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
         crystalReportViewer1.Visible = false;
     }
     else
     {
         tbl.SetDataSource(tb);
         list.Refresh();
         crystalReportViewer1.Visible = true;
     }
     errinf = Program.SqlCmd("delete from Tmp");
 }
        public static void SetTableLogin(CrystalDecisions.CrystalReports.Engine.Table table)
        {
            CrystalDecisions.Shared.TableLogOnInfo tliCurrent = table.LogOnInfo;

            tliCurrent.ConnectionInfo.UserID   = builder.UserID;
            tliCurrent.ConnectionInfo.Password = builder.Password;
            if (builder.InitialCatalog != null)
            {
                tliCurrent.ConnectionInfo.DatabaseName = builder.InitialCatalog;
            }
            if (builder.DataSource != null)
            {
                tliCurrent.ConnectionInfo.ServerName = builder.DataSource;
            }
            table.ApplyLogOnInfo(tliCurrent);
        }