none
Crystal Report not load under a button in C# RRS feed

  • Question

  • Hello , i have a  some code in my project for crystal report :

    using System;
    using System.Collections.Generic;
    using System.ComponentModel;
    using System.Data;
    using System.Drawing;
    using System.Linq;
    using System.Text;
    using System.Threading.Tasks;
    using System.Windows.Forms;
    using System.Data.OleDb;
    using CrystalDecisions;
    using CrystalDecisions.CrystalReports;
    using CrystalDecisions.CrystalReports.Engine;
    
    namespace SalesTable
    {
        public partial class frmFinalBalance : Form
        {
            ReportDocument cryrpt = new ReportDocument();
    
            public frmFinalBalance()
            {
                InitializeComponent();
            }
    
            OleDbConnection con = new OleDbConnection("Provider=OraOLEDB.Oracle.1;Data Source=xe;Password=xyz;User ID=xyz;unicode=true");
            OleDbDataAdapter adp = new OleDbDataAdapter();
            private void frmFinalBalance_Load(object sender, EventArgs e)
            {
                OleDbDataAdapter sda = new OleDbDataAdapter("select * from fbc", con);
              
                DataSet dst = new DataSet();
                sda.Fill(dst);
                cryrpt.Load(@"E:\.......\rptFinalBalance.rpt");
                cryrpt.SetDataSource(dst);
                crystalReportViewer1.ReportSource = cryrpt;
    
    
            }
        }
    }
    

    and the frmFinalBalance form call from a button using the code:

    private void btnPrint2_Click(object sender, EventArgs e)
            {
                new frmFinalBalance().Show();
            }

    When i have run my project showing the error 

    How can solve it? 

    Actually i need  open a external crystal report using  button  Click 

    Saturday, January 27, 2018 5:38 PM

All replies

  • Hi Mr.Khan for U,

    Thank you for posting here.

    For your question is more related to Crystal Report, you could post a new thread in Crystal Report forum for suitable support.

    https://help.sap.com/viewer/p/SAP_CRYSTAL_REPORTS

    The Visual C# forum discuss and ask questions about the C# programming language, IDE, libraries, samples, and tools.

    Best Regards,

    Wendy


    MSDN Community Support
    Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.

    Monday, January 29, 2018 9:08 AM