1

私は 1 つのDatasetバインディングを持っていますReportviewer。私の 2 つのパラメータを持っていdatasetます。レポートには通常、大きなデータが表示されます。問題は、新しい値でパラメータを渡し、reportviewer[検索] をクリックButtonして以前のデータをreportviewer変更することです。新しい検索データが表示されないことを意味します!

ここに私のコードがあります:

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
            mysession() 
            ReportViewer1.ProcessingMode = ProcessingMode.Local 
            Dim rep As LocalReport = ReportViewer1.LocalReport 
            rep.ReportPath = "Leaving Report.rdlc" 
            Dim ds1 As DataSet = GetData() 

            Dim EMpReplt As New ReportDataSource() 
            EMpReplt.Name = "ProlDataSet_Lrepoert" 
            EMpReplt.Value = ds1.Tables("EMPData") 
            rep.DataSources.Add(EMpReplt) 
End sub 

 Private Function GetSalesData() 
        Dim ds As New DataSet 
        Dim sql As String = "select * from laeve where Status='" & DropDownList1.SelectedValue & "' and Agent='" & Session("Agence") & "'" 
            Dim command As New SqlCommand(sql,con) 
            Dim mysqlAdapter As New SqlDataAdapter(command) 
            mysqlAdapter.Fill(ds, "EMPData") 
            mysqlAdapter.Dispose() 
            command.Dispose() 
        End Using 
        Return ds 
    End Function 
 End Sub 


Protected Sub Search_Click(ByVal sender As Object, ByVal e As EventArgs) Handles Button2.Click 
    ReportViewer1.LocalReport.Refresh() 
End Sub
4

1 に答える 1

0

WebForms ReportViewer コントロールの使用を配置してみてください.IsPostBack

Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load 
            mysession() 
   If Not Page.IsPostBack Then
            ReportViewer1.ProcessingMode = ProcessingMode.Local 
            Dim rep As LocalReport = ReportViewer1.LocalReport 
            rep.ReportPath = "Leaving Report.rdlc" 
            Dim ds1 As DataSet = GetData() 

            Dim EMpReplt As New ReportDataSource() 
            EMpReplt.Name = "ProlDataSet_Lrepoert" 
            EMpReplt.Value = ds1.Tables("EMPData") 
            rep.DataSources.Add(EMpReplt) 
     End if
End sub 
于 2013-02-09T06:51:58.097 に答える