Can't get my Reporting Services to work within DotNetNuke

I am trying to add a call to a Microsoft Report from my module.  I have got the following code:


Private Sub btnPrint_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnPrint.Click

Dim format As String = "PDF"

'This is the name/location where the report will be generated on the web server

'the best part is that you can name the actual file anything you want in this code

'give write permissions to this folder:

Dim fileName As String = "C:\Temp\Tester.PDF"

'name of report on the report server that you want to use

'its basically / project name / report name

Dim reportPath As String = "/NDPReports/Report1"

Dim historyID As String = Nothing

Dim deviceInfo As String = Nothing

Dim showHide As String = Nothing

'results is the file stream that we will be using

Dim results() As Byte

Dim encoding As String

Dim mimeType As String

'hbs2 is the name of my web ref to the reportserver,

Dim warnings() As hbs2.Warning = Nothing

Dim reportHistoryParameters() As hbs2.ParameterValue = Nothing

Dim streamIDs() As String = Nothing

'The actual reporting service

Dim rs As New hbs2.ReportingService

rs.Credentials = System.Net.CredentialCache.DefaultCredentials

'report parameters, passed in by querystring

Dim Parameters(1) As hbs2.ParameterValue

Parameters(0) = New hbs2.ParameterValue

Parameters(0).Name = "Initials"

Parameters(0).Value = Request.QueryString("Initials")

Parameters(1) = New hbs2.ParameterValue

Parameters(1).Name = "WorkDate"

Parameters(1).Value = Request.QueryString("WorkDate")

'this is where the report is generated

results = rs.Render(reportPath, format, historyID, deviceInfo, Parameters, _

Nothing, showHide, encoding, mimeType, _

reportHistoryParameters, warnings, streamIDs)

'Write the file to the webserver, using what ever name you want!

Dim stream As FileStream = File.OpenWrite(fileName)

stream.Write(results, 0, results.Length)

stream.Close()

DownloadFile(fileName, True)

Response.ClearContent()

Response.ClearHeaders()

Response.ContentType = "application/pdf"

 

 

 

 

End Sub

'------This is the Download file function that forces the download------------

Private Sub DownloadFile(ByVal fname As String, ByVal forceDownload As Boolean)

Dim path As Path

Dim fullpath = path.GetFullPath(fname)

Dim name = path.GetFileName(fullpath)

Dim ext = path.GetExtension(fullpath)

Dim type As String = ""

If Not IsDBNull(ext) Then

ext = LCase(ext)

End If

Select Case ext

Case ".pdf", ".html"

type = "Application/pdf"

Case ".txt"

type = "text/plain"

Case ".doc", ".rtf"

type = "Application/msword"

Case ".csv", ".xls"

type = "Application/x-msexcel"

Case Else

type = "text/plain"

End Select

If (forceDownload) Then

Response.AppendHeader("content-disposition", "attachment; filename=" + name)

End If

If type <> "" Then

Response.ContentType = type

End If

Response.WriteFile(fullpath)

Response.End()

End Sub


I have added the web reference to the reportserver, but when I load up my dotnetnuke portal I am getting an assembly error?  Any help?

Thanks,

Greg Duke

0
gduke
11/8/2005 9:10:35 PM
asp.net.ssrs 4514 articles. 1 followers. Follow

1 Replies
485 Views

Similar Articles

[PageSpeed] 17

Dear Sir:

I use DotNetNuke as the "menu driver" for all Reporting Services reports -

I have noticed that you are doing a lot of work for the User and maybe you have found a solution - but

If Not -

Within DotNetNuke create a page and within the page indicate that a URL is used to call the application - (call the reporting services report and cust and paste the URL into the DotNetNuke URL for the Page definition) once the user calls the Reporting Services Report - then let the user export to whatever format they want (PDF, Excel, etc.)

Best Regards


_ _ _ _ _ _ __ _ _ _ _ _ _ _ _ _
ดีแนฟืกะฟะรหระ
0
josun
12/8/2005 2:11:17 PM
Reply: