[SOLVED] Crystal Reports (VS 2019) not pulling new data from SQL Server on some computers?


This Content is from Stack Overflow. Question asked by Yoni

I have a WPF Console App in C# running on VS 2019.
I have a few Crystal Reports that have worked without any problems.
If I run in Debug Mode, everything fine
If I run on my computer (the one I develop on), everything is fine.
When I deploy to a users computer.The Report pulls the default data that I used to create the Report, but not the data that I load in the following code:

                            using (SqlDataAdapter adp = new SqlDataAdapter(cmd))
                                adp.Fill(ds, "Ledger");


As I said, on my own system, the program properly loads fresh data from the MS-SQL Server.
But on the other computer, it uses the default
The same program loads another Crystal Report, (inside the same CS file) and that one works fine.

I have tried deleting the entire program and copying it over again.
I cleared the folder in the %AppData%
I am at a loss.

Any suggestions?


from cs file when you call crystal report, you need to pass the sqldetails/credentials, so it will connect that one (called run-time/dynamically assign db) , else it will connect what you configured in design time.

Second option which need one time when there is no luck that open report in crystal report, just verify database from topmenu in that location where you want to run.

Even though, if there is parameter, that also you can pass from c# code like companyid or employeeid etc.

 public void loadReport()
        rd.Load(@"C:\Users\Jeff Enad\Desktop\TEST1\Cebu Hallmark Hotel Management System\Cebu Hallmark Hotel Management System\cryReport.rpt");
        SqlConnection con = new SqlConnection(@"Data Source=.\SQLEXPRESS;Initial Catalog=dbCebuHallmark;Integrated Security=True");
        SqlDataAdapter da = new SqlDataAdapter("GetAllReport", con);
        da.SelectCommand.CommandType = CommandType.StoredProcedure;
        DataSet ds = new System.Data.DataSet();
        da.Fill(ds, "REPORT");
        rd.SetParameterValue("UserPrinted", user); //This is the parameter
        crystalReportViewer1.ReportSource = rd;

Refer this one c# passing database and parameter to crystal report , Crystal Report ask database parameter Login C#

or just search in google "c# crystal report set database and parameter"

This Question was asked in StackOverflow by Yoni and Answered by Ajay2707 It is licensed under the terms of CC BY-SA 2.5. - CC BY-SA 3.0. - CC BY-SA 4.0.

people found this article helpful. What about you?