Ok I tried using Server.MapPath and it made no difference. I don't understand why I'm not seeing the actual control when I load the page. Its just blank. No error, no report viewer...
Main Topics
Browse All TopicsHello Experts:
I've been trying to load an SSRS report in a reportviewer on my asp.net website using vb.net code-behind. I've been trying to user serverreport since I have an active 2008 reporting server. I can't get the report to load. There are no errors, just a blank iframe where the reportviewer should be. I've tried many combinations of serverpath/url. I'm not sure how to load a datasource. In the report directory on the report manager I have a custom datasource. How do I get the report to load using the correct datasrouce?
This Question has been solved and asker verified All Experts Exchange premium technology solutions are available to subscription members.
Experts Exchange has been collecting answers to technology questions since 1996…3 million and counting! If you have a question, chances are we already have your answer.
If you can't find the exact answer you're looking for, ask our exclusive community of 50,000 experts. You’ll get a personalized answer from a trusted professional.
Thousands of free tech tips, tricks, how-to’s and tutorials are available in our peer reviewed articles section. See for yourself how smart our experts are, no login required.
Access the answers to your technology questions today.
30-day free trial. Register in 60 seconds.
Members of the expert community talk about why the experience at Experts Exchange is different than what you will find anywhere else.

Try it out and discover for yourself.
30-day free trial. Register in 60 seconds.
Join the community of experts here and help other tech pros by answering question in your area of expertise. You can earn FREE access to all Experts Exchange's premium features and resources.
It's published to my reportserver.
ReportViewer1.ServerReport
ReportViewer1.ServerReport
when I use http://myip/ReportServer/P
I get the actual report rendered. However, inside the reportviewer I keep getting that error.
I think you can just set the ReportSource of the viewer.
http://www.beansoftware.co
Apologies for confusion. Check here
http://bdotnet.in/forums/p
Ok using that example I got the report to load after one other problem.
Me.Controls.Add(ReportView
form1.Controls.Add(ReportV
Seems it didn't add the reportviewer inside the form tag which has runat=server. Threw some odd error. Got that fixed!
Ok with that finally working we can focus on my original question. Each folder on the reportserver (just 2 folders) has a datasource setup for each of my clients. How do I switch between different datasources depending on which client is viewing the site?
ReportViewer1.ServerReport
Try the following links
http://forums.asp.net/p/12
http://bytes.com/topic/net
http://www.dotnetheaven.co
http://codebetter.com/blog
Make sure you add the proper import statements
http://msdn.microsoft.com/
The example at following link has this import
Imports System.Web.Services.Protoc
http://msdn.microsoft.com/
Even including that I still get problems with their sample.
This is what I used:
' Create datasource for the report.
Dim name As String = "dbname"
Dim parent As String = "/"
Dim rs As New ReportingService()
rs.Credentials = System.Net.CredentialCache
Dim definition As New DataSourceDefinition()
definition.CredentialRetri
definition.ConnectString = "data source=192.168.0.103;initi
definition.Enabled = True
definition.EnabledSpecifie
definition.Extension = "SQL"
definition.ImpersonateUser
'Use the default prompt string.
definition.Prompt = Nothing
definition.WindowsCredenti
rs.CreateDataSource(name, parent, False, definition, Nothing)
It's still having trouble with DataSourceDefinition() and CredentialRetrievalEnum.In
So am I supposed to just add that sub like so:
Public Sub CreateDataSource( _
ByVal DataSource As String, _
ByVal Parent As String, _
ByVal Overwrite As Boolean, _
ByVal Definition As [Namespace].DataSourceDefi
ByVal Properties() As [Namespace].Property _
)
Member of [Namespace].ReportingServi
End Sub
What exactly is [Namespace] supposed to be? Sorry, I've never used "member of" before.
I tried creating this just above my main class already in use:
Class MyNameSpace
Public Shared Sub Main()
Dim rs As New ReportingService()
rs.Credentials = System.Net.CredentialCache
Dim name As String = "AdventureWorks"
Dim parent As String = "/"
' Define the data source definition.
Dim definition As New DataSourceDefinition()
definition.CredentialRetri
definition.ConnectString = "data source=(local);initial catalog=AdventureWorks"
definition.Enabled = True
definition.EnabledSpecifie
definition.Extension = "SQL"
definition.ImpersonateUser
'Use the default prompt string.
definition.Prompt = Nothing
definition.WindowsCredenti
Try
rs.CreateDataSource(name, parent, False, definition, Nothing)
Catch e As SoapException
Console.WriteLine(e.Detail
End Try
End Sub
Sub CreateDataSource( _
ByVal DataSource As String, _
ByVal Parent As String, _
ByVal Overwrite As Boolean, _
ByVal Definition As MyNameSpace.DataSourceDefi
ByVal Properties() As MyNameSpace.Property _
) Member of MyNameSpace.ReportingServi
End Sub
End Class
This is a copy/paste of the example basically. I'm not sure if I used it correctly since it doesn't recognize "MyNameSpace" or "member of". It also still doesn't recognize DataSourceDefinition making me think I still don't have the correct reference.
http://msdn.microsoft.com/
I'm thinking that's what I need to use since the datasources already exist on the reporting server.
Ok I found out why I was having trouble referencing ReportingService(). For some reason my 2008 RS server doesn't have the dll I have to reference. So I did web reference and connected to one of our 2005 RS servers and found the dll there and added it to my project. Now those examples don't give me errors.
So after changing things like the version from 8.0 to 9.0 I don't see any errors. However when I try to load the webform I get an error:
Compiler Error Message: BC30002: Type 'ReportingService' is not defined.
Source Error:
Line 18: Class Sample
Line 19: Public Shared Sub Main()
Line 20: Dim rs As New ReportingService()
Line 21: rs.Credentials = System.Net.CredentialCache
Line 22:
Source File: C:\inetpub\wwwroot\New\GM\
Odd it doesn't show this in the actual developer. I'm still not sure how to set the report to use a specific datasource.
I've gone over the examples a lot. I've tried changing versions with no luck. I also don't see any duplicate references. Not sure how to find this any easier. I only added the dll reference once. I'm using VS08 so I'm sure the reportviewer control I added is causing this but I'm not sure how to fix it.
<%@ Register Assembly="Microsoft.Report
Namespace="Microsoft.Repor
That's whats on my aspx page. The webconfig also contains references to the same assembly. Switching them between 8 and 9 just gives me the same errors. I don't see any othere references anywhere but I'm not sure where to look.
Well I've gone through the entire project and made sure it was version 8. I still get this error:
Compiler Error Message: BC30002: Type 'ReportingService' is not defined.
Source Error:
Line 18: Class Sample
Line 19: Public Shared Sub Main()
Line 20: Dim rs As New ReportingService()
Line 21: rs.Credentials = System.Net.CredentialCache
Line 22: Dim reference As New DataSourceReference()
Source File: C:\inetpub\wwwroot\New\GM\
I'm not sure what else to do at this point.
I added the web reference to the 2005 RS server. "reportservice.wsdl" Then added the code below. I don't get any errors till I actually load the aspx page.
Imports ReportingServices
Class Test
Public Shared Sub Main()
Dim rs As New ReportingService()
rs.Credentials = System.Net.CredentialCache
Dim reference As New DataSourceReference()
reference.Reference = "/myfolder"
Dim dataSources(1) As DataSource
Dim ds As New DataSource()
ds.Item = CType(reference, DataSourceDefinitionOrRefe
ds.Name = "MyDS"
dataSources(0) = ds
End Sub
End Class
Just to follow up in case someone comes across this and has the same trouble. I wasn't referencing the 2008 RS server correctly.
Reference path should be: http://yourserver/reportse
Business Accounts
Answer for Membership
by: CodeCruiserPosted on 2009-08-05 at 01:14:20ID: 25021089
I think you need to use the Server.Mappath for the report url .ReportPat h = Server.MapPath("~/folderna me/execrec ap")
ReportViewer1.ServerReport