Edit: Updated question for clarity: I need to deserialize the SSRS byte stream to a dataset while in memory.
I need to get an SSRS report from VB.Net and get the result into a dataset. I can read and write to XML files, but but for some reason my brain is breaking on putting the XML report directly into a dataset so I can manipulate it.
I can get a report and stream it to an XML file:
Public Sub GetReportNames(serverName As String)
Dim rs As New ReportingService2010()
rs.Credentials = System.Net.CredentialCache.DefaultCredentials
Dim items As CatalogItem() = Nothing
' Retrieve a list of all items from the report server database.
Try
items = rs.ListChildren("/", True)
Catch e As SoapException
MessageBox.Show(e.ToString())
End Try
' Serialize the contents as an XML document and write the contents to a file.
Try
Dim fs As New FileStream("ReportNames.xml", FileMode.Create)
Dim writer As New XmlTextWriter(fs, Encoding.Unicode)
Dim serializer As New XmlSerializer(GetType(CatalogItem())) ''
serializer.Serialize(writer, items)
'MessageBox.Show("Report names successfully written to a file.")
writer.Close()
Catch e As Exception
MessageBox.Show(e.ToString())
End Try
End Sub
I can read an XML file into a VB.net dataset:
Public Sub FileToDataset()
' Serialize the contents as a Dataset
Dim myXMLfile As String = "C:\MyFile.xml"
Dim ds As New DataSet()
' Create new FileStream with which to read the schema.
Dim fsReadXml As New System.IO.FileStream(myXMLfile, FileMode.Open)
ds.ReadXml(fsReadXml)
End Sub
For my project I am starting with getting report names, then will move on to getting the parameters for each report, then will move on to calling reports. I have simple example code for each step, but currently it all involves writing to a XML file on disk...
Edit: It looks like I should be able to do what I need to do from the CatalogItem. Basically I want to load the report names into a TreeView, so CatalogItem should be fine.