Skip to Content
0
Jan 14, 2020 at 11:38 AM

Unable to open database file when exporting crystal report

237 Views

I have created a crystal report and showing fields from DataSet everything works perfectly when i export it to any format it generates a error Unable to open database file and it shows 3 to 4 times in dialog box same error then exported the file successfully, error is generating first time only during exporting after that when i export second time and so on it exported successfully without any issue.

Error message during exporting:

I am unable to figure out the problem from last 2 days and already searched about solution but didn't get any solution yet.

My code:

using (SQLiteConnection con = new SQLiteConnection(AppSettings.ConnectionString()))
{
    con.Open();
    using (SQLiteDataAdapter sda = new SQLiteDataAdapter("SELECT * FROM formData", con))
    {
        sda.Fill(dataSet, "LawData");
        Law_Report objRpt = new Law_Report();
        objRpt.SetDataSource(dataSet);
        ReportViewer.ReportSource = objRpt;
        ReportViewer.Refresh();
    }
    con.Close();
}

I checked the Debugging and i am getting error on the following link, its checking for database file on the this link but why it's checking for database file in this directory? when i manually paste my database file it's working fine but i can't copy my db file in this directory in client machine due to admin privilege

C:\Program Files (x86)\SAP BusinessObjects\Crystal Reports for .NET Framework 4.0\Common\SAP BusinessObjects Enterprise XI 4.0\win32_x86\myDatabase.db

Attachments