I am making a bill report project in window form in C#. When i click on print button ,my report viewer form can not fetch my current data from database which means that when I start application and insert values in the database then my report viewer can not fetch the latest values. But, when I close my application and re open report, then it fetch all data including my last transaction value.
How can i fetch my current values on click of my print button. I tried but it does not not work on current values.
private void Form2_Load(object sender, EventArgs e)
{
cn = new SqlConnection(databaseconnection);
da = new SqlDataAdapter("select * from Bill_Detail order by billId DESC", cn);
DataSet ds = new DataSet();
da.Fill(ds);
int id = Convert.ToInt32(ds.Tables[0].Rows[0][0].ToString());
this.Customer_detailTableAdapter.Fill(this.DataSet1.Customer_detail,id);
this.Bill_DetailTableAdapter.Fill(this.DataSet2.Bill_Detail, id);
this.reportViewer1.RefreshReport();
}