Dim strCreateUrl As String = yourServer + yourReportFolder + "?" + yourReportName + "&rs:Command=Render&rs:format=PDF"
Dim webRequest As System.Net.WebRequest = System.Net.WebRequest.Create(strCreateUrl)
webRequest.Credentials = System.Net.CredentialCache.DefaultCredentials
' Return the response.
Dim webResponse As System.Net.HttpWebResponse = CType(webRequest.GetResponse(), System.Net.HttpWebResponse)
Dim ReceiveStream As System.IO.Stream = webResponse.GetResponseStream()
Dim binByte As Byte()
Dim rdBinaryReader As BinaryReader = New BinaryReader(webResponse.GetResponseStream)
binByte = rdBinaryReader.ReadBytes(webResponse.ContentLength)
rdBinaryReader.Close()
Dim outstream As New MemoryStream()
outstream.Write(binByte, 0, binByte.Length)
Dim buffer(binByte.Length) As Byte
Using stream As FileStream = File.OpenWrite(outputName)
stream.Write(binByte, 0, binByte.Length)
webResponse.Close()
End Using
Monday, December 7, 2009
Saving PDF reports from SQL Server Reporting Services using VB.NET
While there are plenty of C# examples, there are surprisingly few *working* examples of vb.net code to print reports from Reporting Services via code. Hopefully this will help to fill that void. This sample uses SSRS 2005 and VB.NET and should prove to be a welcome change from using third-party com objects for generating pdf files.
Subscribe to:
Post Comments (Atom)
Renovation tips for every room in your home, including information on kitchen renovations and bathroom renovations. Learn how to find a contractor to get your And Home renovations has become big business. Increase the value of your home for future sale or simply make your home more comfortable to live in now.This Blog is Very Nice.
ReplyDeleteI liked the importance of keeping human/humane touch with the students and parents in this era of digital literacy. Mens dress shirts MEN'S CLOTHING & FASHION APPAREL SINCE 1877. Shop Bachrach.com - Men's Suits, Shirts, Ties, Coats, Pants, Blazers & Accessories Online.
ReplyDelete