LuckyCold
asked on
Retrieve reports from reporting server in Asp.Net (vs2005)
Dear experts,
I have created and uploaded a report (rdl) to our reporting server http://www.xxxx.com/Reports2005.
Now I want to retreive the report from the asp.net page. Can someone provide me the code on how to call it. I am very new to the SQLServer reporting services.
Thanks for help.
I have created and uploaded a report (rdl) to our reporting server http://www.xxxx.com/Reports2005.
Now I want to retreive the report from the asp.net page. Can someone provide me the code on how to call it. I am very new to the SQLServer reporting services.
Thanks for help.
ASKER
Hi Gigglick,
Thanks for the quick response.
I have implemented what you said and I got the error message - the attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.
The request failed with http status 404:not found.
Please advise.
Thanks a million,
Here is the code:
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.ReportViewer1.ServerRep ort.Report ServerUrl = New System.Uri("http://myreportservername.com/reports2005")
Me.ReportViewer1.ServerRep ort.Report Path = "Reports/Report1"
Me.ReportViewer1.ServerRep ort.Refres h()
Me.ReportViewer1.Visible = True
End Sub
End Class
Thanks for the quick response.
I have implemented what you said and I got the error message - the attempt to connect to the report server failed. Check your connection information and that the report server is a compatible version.
The request failed with http status 404:not found.
Please advise.
Thanks a million,
Here is the code:
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Me.ReportViewer1.ServerRep
Me.ReportViewer1.ServerRep
Me.ReportViewer1.ServerRep
Me.ReportViewer1.Visible = True
End Sub
End Class
Maybe this site could also helps you.
http://www.dotnetheaven.com/UploadFile/ursbgiri/106012007065515AM/1.aspx
http://www.dotnetheaven.com/UploadFile/ursbgiri/106012007065515AM/1.aspx
Hi -
Sorry didn't realize you hadn't needed to connect to your server at all yet. You'll need to set up a database connection: This shoudl come before the report server refresh code.
SqlConnection cn = new SqlConnection("Data Source=MyServer;Initial Catalog=MyDatabase;Integra ted Security=True");
Sorry didn't realize you hadn't needed to connect to your server at all yet. You'll need to set up a database connection: This shoudl come before the report server refresh code.
SqlConnection cn = new SqlConnection("Data Source=MyServer;Initial Catalog=MyDatabase;Integra
ASKER
Hi Gigglick,
I am ready to go home and I'll try tonight.
Relmada, I already checked the site before I posted the questions. Thanks anyway.
I am ready to go home and I'll try tonight.
Relmada, I already checked the site before I posted the questions. Thanks anyway.
ASKER
Hi Gigglick,
Sorry for the late response. Howerver, I still got the same error "The request failed with HTTP status 404: Not Found. " from the IE browser page. On the ie browser address, it shows "http://localhost:1035/ReportingServices/Default.aspx", but my report is resided on the reporting server (myreportname) not on my workstation. Do you have any clues? Please help. Thanks a million.
Here is the code on mydefault aspx page:
Imports Microsoft.VisualBasic
Imports System.Web.Configuration
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim connectionstring As String = "Data Source=MYDATASOURCE;Initia l Catalog=TestDatabase;Integ rated Security=True"
Dim con As New SqlConnection(connectionst ring)
con.Open()
Me.ReportViewer1.ServerRep ort.Report ServerUrl = New System.Uri("http://myreportname.com/reports2005")
Me.ReportViewer1.ServerRep ort.Report Path = "/Reports/Report1"
Me.ReportViewer1.ServerRep ort.Refres h()
Me.ReportViewer1.Visible = True
con.Close()
End Sub
End Class
Sorry for the late response. Howerver, I still got the same error "The request failed with HTTP status 404: Not Found. " from the IE browser page. On the ie browser address, it shows "http://localhost:1035/ReportingServices/Default.aspx", but my report is resided on the reporting server (myreportname) not on my workstation. Do you have any clues? Please help. Thanks a million.
Here is the code on mydefault aspx page:
Imports Microsoft.VisualBasic
Imports System.Web.Configuration
Imports System.Configuration
Imports System.Data
Imports System.Data.SqlClient
Partial Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim connectionstring As String = "Data Source=MYDATASOURCE;Initia
Dim con As New SqlConnection(connectionst
con.Open()
Me.ReportViewer1.ServerRep
Me.ReportViewer1.ServerRep
Me.ReportViewer1.ServerRep
Me.ReportViewer1.Visible = True
con.Close()
End Sub
End Class
First try taking the .com extension off your report server name in this line of code:
Me.ReportViewer1.ServerRep ort.Report ServerUrl = New System.Uri("http://myreportname.com/reports2005")
Me.ReportViewer1.ServerRep
ASKER
Hi Gigglick,
Yes, I tried it and still go the same error.
Yes, I tried it and still go the same error.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Hi Gigglick,
It works now. I am going to close the solution
Thanks a lot for your help.
It works now. I am going to close the solution
Thanks a lot for your help.
No probs. glad you got it working
Drop a ReportViewer control onto your asp page
Here is a snippit of code I use to refresh a report that has five parameters:
///refresh the report
this.ReportViewer1.ServerR
new System.Uri("http://MyServer/reportserver");
//while (this.ReportViewer1.Server
//{
// this.ReportViewer1.Perform
//}
this.ReportViewer1.ServerR
//this.ReportViewer1.Serve
Microsoft.Reporting.WebFor
new Microsoft.Reporting.WebFor
//string strTime = System.DateTime.Now.ToShor
RptParameters[0] =
new Microsoft.Reporting.WebFor
//RptParameters[1] =
// new Microsoft.Reporting.WebFor
RptParameters[1] =
new Microsoft.Reporting.WebFor
RptParameters[2] =
new Microsoft.Reporting.WebFor
RptParameters[3] =
new Microsoft.Reporting.WebFor
RptParameters[4] =
new Microsoft.Reporting.WebFor
this.ReportViewer1.ServerR
this.ReportViewer1.ServerR
this.ReportViewer1.Visible