Exemplo n.º 1
0
        private void VisualizaRptManifestante_Load(object sender, EventArgs e)
        {
            try
            {
                NpgsqlConnection conn = new NpgsqlConnection("Server=localhost; Port=5432; User Id=postgres; Password=@postgre; Database=ouvidoria;");
                conn.Open();
                NpgsqlCommand comando = new NpgsqlCommand("SELECT * FROM manifestacao WHERE cod_manifestante = @cod_manifestante", conn);
                comando.Parameters.AddWithValue("@cod_manifestante", codManifestante);

                NpgsqlDataAdapter da           = new NpgsqlDataAdapter(comando);
                DataSet           ds           = new DataSet();
                DataTable         manifestacao = new DataTable();
                da.Fill(manifestacao);
                RptManifestante rptManifestante = new RptManifestante();
                rptManifestante.SetDataSource(manifestacao);
                crystalReportViewerManifestante.ReportSource = rptManifestante;
                crystalReportViewerManifestante.Refresh();

                this.WindowState = FormWindowState.Maximized;
            }
            catch
            {
                MessageBox.Show("PostgreSQL Error!", "Erro!", MessageBoxButtons.OK, MessageBoxIcon.Error);
            }
        }
Exemplo n.º 2
0
        public virtual CrystalDecisions.CrystalReports.Engine.ReportDocument CreateReport()
        {
            RptManifestante rpt = new RptManifestante();

            rpt.Site = this.Site;
            return(rpt);
        }