none
An error occurred during local report processing.The definition of the report '' is invalid.The definition of this report is not valid or supported by this version of Reporting Services. he report definition may have been created with a later version of R RRS feed

  • Question

  • Hi,

    I am trying to create rdlc file programmatically. Using Memory Table as dataset. Here is my code

    ' For each field in the resultset, add the name to an array listDim m_fields AsArrayList   m_fields = NewArrayList()   Dim i AsIntegerFor i = 0 To tbdataset.Tables(0).Columns.Count - 1       m_fields.Add(tbdataset.Tables(0).Columns(i).ColumnName.ToString)   Next i   'Create Report 'http://schemas.microsoft.com/sqlserver/reporting/2008/01/reportdefinition'http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition' Open a new RDL file stream for writingDim stream AsFileStream   stream = File.OpenWrite("D:\MyTestReport2.rdlc")   Dim writer AsNewXmlTextWriter(stream, Encoding.UTF8)   ' Causes child elements to be indented   writer.Formatting = Formatting.Indented   ' Report element   writer.WriteProcessingInstruction("xml""version=""1.0"" encoding=""utf-8""")   writer.WriteStartElement("Report")   writer.WriteAttributeString("xmlns"Nothing"http://schemas.microsoft.com/sqlserver/reporting/2010/01/reportdefinition")   writer.WriteAttributeString("xmlns:rd""http://schemas.microsoft.com/SQLServer/reporting/reportdesigner")   writer.WriteStartElement("ReportSections")   writer.WriteStartElement("ReportSection")   writer.WriteElementString("Width""11in")   writer.WriteStartElement("Body")   writer.WriteElementString("Height""5in")   writer.WriteStartElement("ReportItems")   writer.WriteStartElement("Tablix")   writer.WriteAttributeString("Name"Nothing"Tablix1")   writer.WriteElementString("Top"".5in")   writer.WriteElementString("Left"".5in")   writer.WriteElementString("Height"".5in")   writer.WriteElementString("Width", (m_fields.Count * 1.5).ToString() + "in")   writer.WriteStartElement("TablixBody")   ' Tablix Columns   writer.WriteStartElement("TablixColumns")   ForEach fieldName In m_fields       writer.WriteStartElement("TablixColumn")       writer.WriteElementString("Width""1.5in")       writer.WriteEndElement() ' TableColumnNext fieldName   writer.WriteEndElement() ' TablixColumns' Header Row   writer.WriteStartElement("TablixRows")   writer.WriteStartElement("TablixRow")   writer.WriteElementString("Height"".25in")   writer.WriteStartElement("TablixCells")   ForEach fieldName In m_fields       writer.WriteStartElement("TablixCell")       writer.WriteStartElement("CellContents")       writer.WriteStartElement("Textbox")       writer.WriteAttributeString("Name"Nothing"Header" + fieldName)       ' writer.WriteAttributeString("CanGrow",  True)' writer.WriteAttributeString("Keeptogether", True)       writer.WriteStartElement("Paragraphs")       writer.WriteStartElement("Paragraph")       writer.WriteStartElement("TextRuns")       writer.WriteStartElement("TextRun")       writer.WriteElementString("Value", fieldName)       writer.WriteStartElement("Style")       writer.WriteElementString("TextDecoration""Underline")       writer.WriteElementString("PaddingTop""0in")       writer.WriteElementString("PaddingLeft""0in")       writer.WriteElementString("LineHeight"".5in")       ''writer.WriteElementString("Width", "1.5in")''writer.WriteElementString("Value", fieldName)       writer.WriteEndElement() ' Style       writer.WriteEndElement() ' TextRun       writer.WriteEndElement() ' TextRuns       writer.WriteEndElement() ' Paragraph       writer.WriteEndElement() ' Paragraphs       writer.WriteEndElement() ' TexBox       writer.WriteEndElement() ' CellContents       writer.WriteEndElement() ' TablixCellNext   writer.WriteEndElement() ' TablixCells   writer.WriteEndElement() ' TablixRow'writer.WriteEndElement() ' TablixRows          Do not close Rows tag here colse it after details'End of Headers'Details Rows'writer.WriteStartElement("TablixRows")         Since Rows tag in header is not closed not need to open fresh tag   writer.WriteStartElement("TablixRow")   writer.WriteElementString("Height"".25in")   writer.WriteStartElement("TablixCells")   ForEach fieldName In m_fields       writer.WriteStartElement("TablixCell")       writer.WriteStartElement("CellContents")       writer.WriteStartElement("Textbox")       writer.WriteAttributeString("Name"Nothing, fieldName)       '  writer.WriteAttributeString("CanGrow", True)'  writer.WriteAttributeString("Keeptogether", True)       writer.WriteStartElement("Paragraphs")       writer.WriteStartElement("Paragraph")       writer.WriteStartElement("TextRuns")       writer.WriteStartElement("TextRun")       'writer.WriteElementString("Value", fieldName)       writer.WriteElementString("Value""=Fields!" + fieldName + ".Value")       writer.WriteStartElement("Style")       writer.WriteElementString("TextDecoration""Underline")       writer.WriteElementString("PaddingTop""0in")       writer.WriteElementString("PaddingLeft""0in")       writer.WriteElementString("LineHeight"".5in")       ''writer.WriteElementString("Width", "1.5in")''writer.WriteElementString("Value", fieldName)       writer.WriteEndElement() ' Style       writer.WriteEndElement() ' TextRun       writer.WriteEndElement() ' TextRuns       writer.WriteEndElement() ' Paragraph       writer.WriteEndElement() ' Paragraphs       writer.WriteEndElement() ' TexBox       writer.WriteEndElement() ' CellContents       writer.WriteEndElement() ' TablixCellNext   writer.WriteEndElement() ' TablixCells   writer.WriteEndElement() ' TablixRow   writer.WriteEndElement() ' TablixRows'End of Details Rows   writer.WriteEndElement() ' TablixBody   writer.WriteStartElement("TablixRowHierarchy")   writer.WriteStartElement("TablixMembers")   writer.WriteStartElement("TablixMember")   ' Group   writer.WriteElementString("KeepWithGroup""After")   writer.WriteEndElement() ' TablixMember' Detail Group   writer.WriteStartElement("TablixMember")   writer.WriteStartElement("Group")   writer.WriteAttributeString("Name"Nothing"Details")   writer.WriteEndElement() ' Group   writer.WriteEndElement() ' TablixMember   writer.WriteEndElement() ' TablixMembers   writer.WriteEndElement() ' TablixRowHierarchy   writer.WriteStartElement("TablixColumnHierarchy")   writer.WriteStartElement("TablixMembers")   'writer.WriteStartElement("TablixMember")ForEach fieldName In m_fields       writer.WriteStartElement("TablixMember")       writer.WriteEndElement() ' TablixMemberNext' writer.WriteEndElement() ' TablixMember   writer.WriteEndElement() ' TablixMembers   writer.WriteEndElement() ' TablixColumnHierarchy   writer.WriteElementString("DataSetName""tbdataset")   writer.WriteEndElement() ' Tablix   writer.WriteEndElement() ' ReportItems   writer.WriteEndElement() ' Body   writer.WriteStartElement("Page")   ' Page Header Element   writer.WriteStartElement("PageHeader")   writer.WriteElementString("Height""1.40cm")   writer.WriteStartElement("ReportItems")   writer.WriteStartElement("Textbox")   writer.WriteAttributeString("Name"Nothing"Textbox1")   writer.WriteStartElement("Paragraphs")   writer.WriteStartElement("Paragraph")   writer.WriteStartElement("TextRuns")   writer.WriteStartElement("TextRun")   writer.WriteElementString("Value"Nothing"ABC CHS.")   writer.WriteEndElement() ' TextRun   writer.WriteEndElement() ' TextRuns   writer.WriteEndElement() ' Paragraph   writer.WriteEndElement() ' Paragraphs   writer.WriteEndElement() ' TextBox   writer.WriteEndElement() ' ReportItems   writer.WriteEndElement() ' PageHeader   writer.WriteEndElement() ' Page   writer.WriteEndElement() ' ReportSection   writer.WriteEndElement() ' ReportSections' DataSources   writer.WriteStartElement("DataSources")   writer.WriteStartElement("DataSource")   writer.WriteAttributeString("Name"Nothing"tbdata")   writer.WriteStartElement("DataSourceReference")   writer.WriteEndElement() ' DataSourceReference   writer.WriteEndElement() ' DataSource   writer.WriteEndElement() ' DataSources'DataSet   writer.WriteStartElement("DataSets")   writer.WriteStartElement("DataSet")   writer.WriteAttributeString("Name"Nothing"tbdataset")   writer.WriteStartElement("Query")   writer.WriteElementString("DataSourceName"Nothing"tbdata")   'writer.WriteElementString("CommandText", Nothing, "/* Local Query */")   writer.WriteElementString("CommandText"Nothing"TableDirect")   writer.WriteEndElement() ' Query'Fields   writer.WriteStartElement("Fields")   ForEach fieldName In m_fields       writer.WriteStartElement("Field")       writer.WriteAttributeString("Name"Nothing, fieldName)       writer.WriteElementString("DataField", fieldName)       writer.WriteElementString("rd:TypeName", fieldName.GetType.ToString)       writer.WriteEndElement() ' FieldNext   writer.WriteEndElement() ' Fields' rd datasetinfo   writer.WriteEndElement() ' DataSet   writer.WriteEndElement() ' DataSets   writer.WriteEndElement() ' Report' Flush the writer and close the stream   writer.Flush()   stream.Close()   'Convert to StreamDim myByteArray AsByte() = System.Text.Encoding.UTF8.GetBytes("D:\MyTestReport2.rdlc")   Dim ms AsNewMemoryStream(myByteArray)   'Supply Stream to ReportViewer   ReportViewer1.LocalReport.LoadReportDefinition(ms)   ReportViewer1.LocalReport.Refresh()

    When I open rdlc in designer I get following error

    "Data at the root level is invalid."

    When I run the aspx I get following error

    • An error occurred during local report processing.
    • The definition of the report '' is invalid.
    • The definition of this report is not valid or supported by this version of Reporting Services.
    • The report definition may have been created with a later version of Reporting Services, or contain content that is not well-formed or not valid based on Reporting Services schemas.
    • Details: Data at the root level is invalid. Line 1, position 1.

    Can anybody guide me?

    Monday, December 15, 2014 2:51 PM