Search code examples
c#mysqlvisual-studio-2013crystal-reports

Source Not Available for Crystal report on visual studio 2013


I'm developing a windows application with c#. I want to generate a report with data which i stored in MySQL database. I used SAP crystal report to generate it. but after clicking generate button (button used for generating a report) there is an error occurred.

Here is my error

my code

private void btnGen_Click(object sender, EventArgs e)
    {
        //show second form called as Report
        Report rpt = new Report();
        rpt.Show();
    } 

this is Report Form

public void GenerateReport()
    {

        try
        {

            db_connection();
            string q4 = "select * from detail";
            mcd = new MySqlCommand(q4, connect);
            mcd.ExecuteNonQuery();
            DataSet1 d1 = new DataSet1();
            MySqlDataAdapter sda = new MySqlDataAdapter(mcd);
            sda.Fill(d1.detail);
            CrystalReport1 crpt = new CrystalReport1();
            crpt.SetDataSource(d1);
            CristalRptViewr.ReportSource = crpt;
        }
        catch (Exception e)
        {
            MessageBox.Show(e.ToString());
        }
        finally
        {
            connect.Close();
        }
    }

here detail is my database table please help me... Thank you


Solution

  • It will be saying that You have a missing component named as crdb_adoplus.dll in the dotnet1 directory. You should make a directory in the said folder and then add the said .dll component in that directory. You can download that component from net and then add following in your config file:

    <startup useLegacyV2RuntimeActivationPolicy="true">
        <supportedRuntime version="v4.0" sku=".NETFramework,Version=v4.0"/>
    </startup>
    

    Then before building your project delete the bin and obj folders and then rebuild your project. Hope it solves the problem.

    If the problem still don't solve then try to delete all your crystal assemblies and reinstall the crystal environement for .NET