Click here to Skip to main content
15,888,816 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
when i press server report button then it display server report and when i press local report button then show me also server report
here is the code


C#
***Server Report***
ReportViewer1.ProcessingMode = ProcessingMode.Remote
ReportViewer1.ServerReport.ReportServerUrl = New Uri("http://XXX.XXX.XXX.XXX/ReportServer")
ReportViewer1.ServerReport.ReportPath = "<ServerReport Path>"
Dim myCred As NetworkCredential = New NetworkCredential("<User Name>", "<Password>", "http://XXX.XXX.XXX.XXX/ReportServer")
ReportViewer1.ServerReport.ReportServerCredentials.NetworkCredentials = myCred
Dim parameters As New List(Of ReportParameter)
parameters.Add(New ReportParameter("Str", str))
ReportViewer1.ServerReport.SetParameters(parameters)
ReportViewer1.ServerReport.Refresh()
Me.ReportViewer1.RefreshReport()


<big>***Local Report***
   Dim ds As DataSet
ds = sql.FetchDataSet("<Query>")
Dim reportPath As String = Application.StartupPath & "Report Path"
ReportViewer1.LocalReport.DataSources.Clear()
ReportViewer1.LocalReport.DataSources().Add(New Microsoft.Reporting.WinForms.ReportDataSource("DataSet1", ds.Tables(0)))
ReportViewer1.LocalReport.ReportPath = reportPath
ReportViewer1.RefreshReport()
Posted
Updated 5-Dec-17 21:10pm
Comments
Suvendu Shekhar Giri 4-Jan-16 3:23am    
Not clear. Please add more description of the problem.
Praful Karkar 4-Jan-16 4:42am    
i have two reports and i want to show first report in server and second one in local computer and it must be show in one form,
when i press server report button then it gives correct report but when i press local report button then it again shows server report instead of local report
CHill60 4-Jan-16 11:42am    
I'm not sure but I think you have to use InitializeViewer when you change between the reports
Praful Karkar 4-Jan-16 23:37pm    
sorry but i cant understand please give some detail about initialize viewer
CHill60 7-Jan-16 10:10am    
I found this article[^][^]

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900