为什么我的报表查看器不显示数据库中的当前事务值?

时间:2014-03-31 07:44:04

标签: c#

我正在使用C#中的窗口表单应用程序从数据库生成唯一的bill no。 我正在使用报表查看器控件。

在输入该客户的账单的所有详细信息后,当我点击打印按钮时,它无法在报告中显示当前账单中没有来自数据库的详细信息。

当我关闭我的应用程序并再次启动它然后显示 我已经尝试过,但它不能用于当前价值。

如何在点击我的打印按钮时获取当前值。我尝试了但它对当前值没有用。

private void button3_Click(object sender, EventArgs e) 
{ 
this.Close(); Form2 f2 = new Form2(); f2.Show(); 
}

单击此按钮打开报表查看器窗体打开,我在页面加载事件

上写下此代码
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());



    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(); 
} 

我尝试了另一种方式

     int id = Convert.ToInt32(Form1.lblbillno1);
    this.Customer_detailTableAdapter.Fill(this.DataSet1.Customer_detail,id);             
     this.Bill_DetailTableAdapter.Fill(this.DataSet2.Bill_Detail,id);
     reportViewer1.LocalReport.Refresh();
     this.reportViewer1.RefreshReport

0 个答案:

没有答案