title: Crystal report unable to refresh data
body: <p>I was generating the Crystal Report viewer using WPF and I was able to load data in the report viewer. But when I was trying to create an event to refresh the report dynamically, the data could not be refreshed.</p>
  
  <p>Basically what I have done is creating a dataSet connecting with the MSSQL Server<img src="https://i.stack.imgur.com/CStm6.jpg" alt="enter image description here"></p>
  
  <p>Then generate a Crystal Report file:<img src="https://i.stack.imgur.com/WIi69.jpg" alt="enter image description here"></p>
  
  <p>And then trying to import data into the Crystal report viewer in the MainWindow.
  Here is the code:</p>
  
  <pre><code>public partial class MainWindow: Window
  {
     DataSet1TableAdapters.BordierSheetTableAdapter TA = new      DataSet1TableAdapters.BordierSheetTableAdapter();
       ReportDocument reportDoc = new ReportDocument();
    public MainWindow()
      {
          InitializeComponent();
          Data_Binding();
      }
    public void button2_Click(object sender, RoutedEventArgs e) 
      {
         reportDoc.Refresh();
         crystalReportsViewer1.ViewerCore.RefreshReport();
      }
    void Data_Binding()
       {
  
           DataSet empDataSet = new DataSet();
  
           using (SqlConnection conn = new SqlConnection())
           {
               conn.ConnectionString = "Data Source=YATONGHOU\\SQLEXPRESS;Initial Catalog=messagedb;Integrated Security=True";
               conn.Open();
  
  
               string sqlStr = "select * from BordierSheet";
               SqlDataAdapter dataAdapter = new SqlDataAdapter(sqlStr,conn);
  
               dataAdapter.Fill(empDataSet, "BordierSheet");
           }
  
           string reportDataSource = @"C:\\Users\\yatong\\Work\\LogAnalytics\\BordierSheetReport\\BordierSheetReport\\CrystalReport1.rpt";
  
           reportDoc.Load(reportDataSource);
           reportDoc.SetDataSource(empDataSet);
  
           this.crystalReportsViewer1.ViewerCore.ReportSource = reportDoc;
  
       }
  }
  </code></pre>
  
  <p>When I updated my data base and then click the button in the window (which triggers the button2_Click(object sender, RoutedEventArgs e) function), no data has been updated.
  So could anyone help me with this please?
  Thank you very much.</p>